Dockers ans scalability [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have several questions about dockers for freshers, could somebody help me please?
As I learned, containers don't have OS inside of them, they all share one OS of the cloud server.
But what if I want to deploy app that was written from diff platform?
For example I have Linux on server, but on my own machine I've Windows.
So I develop java app, using JDK for windows..
Now I use docker to build the image (as I understand I should pack my app, its libs and JDK for windows at one container with help of docker file and put it to Linux Server...so how my app will work on Linux inside of container?)
Please help me to understand how does it work, becouse I miss something here
Scalability. Why we want to copy the applications on server (as written, the containers are very lightweight and easy to copy), why not to use multithreading?

Containers do have OS's - for example you can run AlpineOS or Fedora containers on Ubuntu. The package space and libraries are not shared with the host.
Java doesn't care where you run it; Docker is not a requirement. In any case, you can package the app with a Windows JDK (no container) and copy it into a container with only a JRE (you should only need a JDK to compile). Or you use multi-stage Docker builds to use a Linux JDK to compile and package your artifacts, then copy that into the same JRE runtime layer
Containers and multithreading aren't exclusive. Besides, I think you meant multi-processing which would require an external supervisor process (which is specific to the OS), compared to using a container orchestrator. Also copies of the application artifact shouldn't be needed, only memory space needed for the process(es)

Related

Is java 9 and above still platform independent or not? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am asking this question because now developer needs to compile his code on different OS like windows, Linux, or Mac OS to create the final deliverable. It looks bigger overhead for developers.
Yes of course it is still platform independent.
Java Bytecode does not change between Windows, Linux or Mac OS.
You can take the class files compiled on windows, or a Jar file with classes inside, and copy them to a Linux or Mac OS machine, and they will work, as long as the platform's major version is the same or later than that of the one where they were originally compiled.
So if they were compiled with a Java 9 compiler targeting a Java 9 runtime, the platform executing them will need to be Java 9 or later. Otherwise you would get an UnsupportedClassVersionError.
You seem to have misunderstood the Self-Contained Application Packaging ability of Java 9 that looks set to replace Java Web Start as a deployment tool for desktop apps.
JWS used a plain Jar as the deliverable but required that a Java Runtime Environment on the user machine already be installed. On the other hand, the packaging tool will wrap that Jar into an executable suitable for Windows (a .exe) or Unix (a .so) etc. To do so, it would require that the native executable has the parts of the JRE coded for each system (Jars are platform independent but JREs need to be made for each OS).
If you deliver an executable Jar to the user (and inform them they need the Java plug-in installed, to run it), then that Jar will still be compatible for all OS on which Java is supported.
java is platform independent but java runtime environment(jre) isn't.
so, if developer want to provide product for various platform without installing jre in user's environment,
the product should contain different jre for each platform.
+) compilation doesn't matter, it needs to be done just once.

Is is possible to distribute java Desktop application which uses executables generated using C? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am developing a Java Desktop application which runs a shell script. This script is supposed to run an executable generated using C.The executable which my C code has generated is dependent on shared libraries.
I don't want to include the C code in the Application. Hence I won't be able to generate a new executable on client's PC when I wish to distribute it. As I have read, the object code as well as the executable are machine dependent and therefore I won't be able to run this executable (generated by compiling and linking on my machine) on my client's machine having different hardware configurations.
Right now I have included only the executable in JAR and I am able to run the shell script in Java (using Runtime.getRuntime().exec(shell_script) in Java). As I have said earlier, this executable is dependent on shared libraries and when the software(executing the script) is run on different PC,it reports an error saying that one of the shared libraries is missing.
I want a suggestion on how to run an executable which is compiled and linked on different machine and which is dependent on shared libraries in a desktop application(which needs to be distributed).
Please comment if I am going wrong anywhere or if you feel that I have misunderstood any concept.
Thanks in advance.
Compile your C code into a different executable for every supported
OS and put them all into your JAR file.
Detect the current OS from your Java application and extract the proper executable for that OS from your JAR file.
Run the extracted executable.

How to run java 6 and java 7 simultaneously [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have java 6 installed in one of my servers running application x. Now I was giving application y that is supposed to run in the same server. However, they "forgot" to tell me that application y needs java 7, not 6.
After reading a bit on the internet, I realized that it's possible to run multiple versions of java in the same windows box, but I cannot make sense of what to do with the environment variable and how it know when to use java 6 or 7. Does anyone either know what I need to do or of a website where I could find good information?
Thank you!
Do not rely on JAVA_HOME environment variables, most applications can be run using an absolute path. You don't even need to run Java setup.exe on server machine. This quarantees you don't accidentally get Java browser Plugin and version controlling is easier.
Run Java6 and Java7 setup.exe in one machine say your personal laptop
Go to c:\program files\Java\Java_xxx folder and zip it
Unzip to a server, say c:\java\Java_xxx folder, you should see Java_xxx\bin\java.exe file
Uninstall Java6 and Java7 from laptop if you don't need it
Server machine may not need JAVA_HOME envvar to mess versions up
Use JavaJRE or JavaSDK both are fine or side by side everything
Run java application using an absolute path, you may create a shortcut or .bat script to run application.
c:\java\Java_xxx\bin\java.exe -cp ./lib/myapp.jar;./classes com.package.MyAppMain param1 param2

Is Eclipse enough to make an EXE using java? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm going to study java via the Book "Head First: Java".. So im going to use Eclipse, when I was in 3rd year college, we do very basic Java programming, we only used Notepad++ and command prompt for compiling.
I like to know if I can make exe using eclipse and java alone. What about GUIs? I only done application in android, so I code using "button.setText"" things, but what about Java application for desktop, how can I make GUIs? EXEs? Are there other programs I will use?
I would start creating simple PC apps like a calculator. How can I do that?
Launch4j is a cross-platform tool for wrapping Java applications distributed as jars in lightweight Windows native executables. The executable can be configured to search for a certain JRE version or use a bundled one, and it's possible to set runtime options, like the initial/max heap size. The wrapper also provides better user experience through an application icon, a native pre-JRE splash screen, a custom process name, and a Java download page in case the appropriate JRE cannot be found.
I would say launch4j is the best tool for converting a java source code(.java) to .exe file You can even bundle a jre with it for distribution and the exe can even be iconified. Although the size of application increases, it makes sure that the application will work perfectly even if the user does not have a jre installed.
If you only want to use Eclipse and java, then you probably should use SWT and, optionnally, RCP.
SWT is a native widget toolkit allowing you to build applications and RCP adds a framework layer to build complex applications like Eclipse itself and package them as exe (on windows).
But note that building desktop applications as exe is demanding. Before you dive into RCP you might want to look for other solutions, even if they require additional frameworks or tools you don't have in Eclipse.
To make GUIs Eclipse has Window Builder Pro, which allows you to make GUIs easily
https://developers.google.com/java-dev-tools/download-wbpro?hl=pt
For make an executable (jar, in Java case), Eclipse is enough. If you really want to build an ".exe" there are many plugins you can use, such as Launch4j
For making drag and drop GUI, eclipse doesn't provide functionality. For drag and drop GUI, you have to go with Netbeans. For creating .exe, you have to use some third party jar to exe converter tool.

Deploying a project on a server [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I developed a website using netbeans 6.9.1 and glassfish and now i have to install it on a real server. What are the steps i should take to make this working ?
1.) Install the exact version of MySQL i was working on my machine
2.) Install Glass fish (I think i did something after logging into
Glassfish admin portal, but i am not sure what i did)
Can someone brief me up with what i have to do ?
You must take care of several things:
correct / supported OS (MySQL, Glassfish, JDK) and hosting environment (physical, virtual, cloud, etc.)
JDK version / vendor
storage requirements
Glassfish installation, installation guide is here
MySQL installation, if I remember correctly it's packaged with the product
Configure all components for production (e.g. JVM heap size, OS configuration)
If required set up appropriate monitoring tools (servers up, storage allocations, etc.)
Verify whether you can get a least 2 (e.g. virtual) servers (production, staging/test)
You should create proper installation guides and operational manuals, this depends on your environment. This can become a complex task...
Edit: Depending on your non-functional requirements you may want to have the DB on a separate server and build an application server cluster. As #Vineet mentioned you should look for professional help if it's a large environment.

Categories

Resources