Compiling java project using terminal [closed] - java

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 9 years ago.
Improve this question
There is a project called javachallenge that contains four folders inside it: bin, ee, server ,src.
this projects need server/server.jar for external library and it's main method is inside src/javachallenge/client/Connector.java
how can i run this project using terminal?

You have to make sure the JDK binaries are on your PATH, and then you call javac (The java compiler).
Please see http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html for information on how to use the java compiler.
After you compiled all classes, you call java -cp /path/to/compiled/classes:server/server.jar javachallenge.client.Connector (assuming the class is in the javachallenge.client package. The -cp option tells the Java virtual machine where to look for classes, so you have to include both the directory with classes you compiled before, and the external library these classes depend on.
You can call both java and javac with no arguments to get a list of available options if you get stuck.

Related

jpackage not found - mac OS [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 2 years ago.
Improve this question
I'm trying to make my .jar file with the javafx stuff into an executable application, but when I try to do jpackage on the command line, I'm getting command not found. I've downloaded the latest jdk-15.0.1_osx-x64_bin.dmg from Oracle.
Although some Java commands are defined (eg java, javac) And are in the local /usr/bin directory, they only contain commands that were in the Java 6 release (including eg appletviewer).
Newer commands that were added in later Java releases like jmod, jlink etc aren’t available in the path. I’ve raised a radar (bug) at Apple a few years ago And the response was “so?” — don’t hold your breath.
To run these commands you will need to add the Home/bin directory of your install (under /Library/Java/JavaVirtual/Machines) to your PATH environment variable. You can also use /usr/libexec/java_home to find the path of the installed JVM automatically.

How to properly build native executable file from jar? [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 3 years ago.
Improve this question
I have had Intellij IDEA generate an executable jar for me and executing the jar using java -jar command works great.
But when I try to wrap this jar into an exe file using launch4j, various errors happen. First there was an error saying "Could not find or load main class".
After looking at this and this questions I thought the problem is about pathnames or classnames. However, that was not the case. Apparently, the main class was found, but couldn't be loaded because there was no pathnames to Java and JavaFX runtimes.
After adding rt.jar and jfxrt.jar to classpaths another error appeared:
"JavaFX runtime components are missing, and are required to run this application"
And now I really don't know what to do. I downloaded the latest jre (8.0.221) but nothing changed. jfxrt.jar is a JavaFX runtime to my knowledge, but it seems like the application doesn't recognize it as one.
Any recommendations for deploying, suggestions for my project or remarks are welcome and appreciated. Thanks!
I achieved what I wanted by using one of launch4j built-in functions. In section JRE there is an option for bundled jre path. And to create native app launcher with bundled jre you just have to specify the path of jre. This took me 5 days to find.
You can make .exe file using Inno tool set up.
I have used this there was no error, exe runs fine.
Link :- http://www.jrsoftware.org/ishelp/

Can someone help me how to create a executable file/ app/utility using java programs files in mac computer? [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 3 years ago.
Improve this question
Need to create a jar file of 3/4 .java files and then create an executable file which just need to be double clicked to run the main program in mac PC.
The first step is to compile your .java source files to .class files and potentially package them into a .jar file. One of your classes must have a main method so it can be run as a Java application.
I believe there are commercial products to create executable binaries but take a look at the GraalVM native-image tool. This tool can create an executable binary for Linux or Mac from a jar file.

When is .class file created in JDK like eclipse? [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 7 years ago.
Improve this question
Can anyone tell what happens in case of JDK's while we write code and save the file to run the application. Where and when will the .class file for my code get generated?
Inside your project, a bin folder will be created and inside the bin folder, you will have your .class files. class files will be created when your code is compiled.
When you click "run" or "build" in eclipse, the compiler will generate the .class files which contain your compiled code. They will be in the /bin/ folder of your project.
When you will compile your code the .class will be created in the bin folder.
On a side note: Eclipse is automatically compiling your code and this option can be disabed by un-checking the build automatically in Project menu

Run ".jar" through shell [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 8 years ago.
Improve this question
I am making an android application that aims to run a .jar file that's a java7 based console application. Could someone direct me on a way I can run this file with a shell command within my application's code?
You can't. Android doesn't come with a Java 7 VM. The Dalvik VM it uses is not compatible.
Do you mean just opening a console and running the jar? If yes, the command goes like:
java -jar <my jar file>
Can you please be more clear?
If what you are trying is to run the jar from the command line (terminal) then just use
java -jar <jarfile>
If you are trying to run a class that is inside the jar, then just make sure the jar is in the classpath and use the class directly.

Categories