This question already has answers here:
How to run a JAR file
(12 answers)
Closed 6 years ago.
I downloaded this file from a website ! The problem is that I have no knowledge of java :p ! ( I cannot execute that file )
Here's the file:
Atome.jar
When I double click, nothing happens !!
Please guys help me !
This jar was not created to be executed with a simple double-click but probably to be used in a program. In fact, in the Manifest file which is in the jar, there are no Main class defined and none of the class files in the jar is the Main class (I tried with the 3 principal classes)
So, this jar is probably just a library that should be used by a developer
Related
This question already has answers here:
Why do my java files look strange in Eclipse?
(5 answers)
Closed 1 year ago.
I have two class .java but in pdcController.java I cannot do anything:
Look the image:
Look the icon are different in BandoService works all, but in .pdfController I cannot do anything (for example I cannot suggest for method or error import). pdfController and BandoServiceare in the same project.
This is not the source file, check the file path, you're probably not in the correct package.
I guess you have several modules in your maven project and you opened the file from the parent module.
If you see the file only in the parent module it's time to git fetch.
This question already has answers here:
Problem with IntelliJ -> Cannot create class with name "Main"
(2 answers)
Closed 2 years ago.
I cannot create java class file with name TokenProperties.java. I also tried restart and clean cache but doesn't help. Class with different name I can crate.
Here is error pop-up.
File will added but marked as plain text file, and no java file.
Do you have idea whats is going on? Thank you.
It kind of looks like you create a TXT file with the name TokenProperties.java when you want to create a JAVA file with the name TokenProperties similar to how DemoAAplication was created.
Right click com.example.demoa package.
Select New
Select Java Class
I wasn't able to fix it so I reinstalled Intellij and now it works.
This question already has answers here:
How to read text file from classpath in Java?
(17 answers)
Closed 3 years ago.
I want to read the configuration file outside the jar, how should I do?
I tried classloader.getResourceAsStream("config.xml") and succeeded while I am running the code inside Intellij. Now I want to build the jars to a folder and place the config.xml under the same folder, not inside the jar, but the program fails to detect the config.xml.
Is there a graceful way of reading the config.xml instead of using File with relative path in the code, which doesn't work while debugging/running inside the IDE?
Yes, turn it into a system property, and provide it to anything running any Java process/application.
Let's say you have a config.xml file located inside /some/path/down/the/line/, then you can do: java --classpath ... -Dapp.config=/some/path/down/the/line/config.xml tld.domain.Application.
Then all you have to do in your Java code is to reference that name/path: final String configFile = System.getProperty("app.config");, and use any well-known routine to read it from there.
Basically, you have to make sure the file/path/location is provided somehow to the Java classpath.
This question already has answers here:
Execute another jar in a Java program
(7 answers)
Closed 5 years ago.
I am having the java main application which needs to execute another jar file and return it without waiting for the jar execution complete. Is it possible to achieve it using Java. Can anyone give some inputs in it.
Do following:
Runtime.getRuntime().exec("java -jar <PATH_OF _JAR>");
in your Main class.
And as #Yoav has suggested. You need to take care of errors by adopting proper error handling strategy.
Do Read - https://www.tutorialspoint.com/java/lang/runtime_exec.htm
This question already has answers here:
Run exe which is packaged inside jar file
(6 answers)
Closed 5 years ago.
In eclipse, if you have a .exe file in the package how would you run it? I know if it is outside you would just add in the path, but what would the path be for something inside the project?
Lets imagine a File f = new File(Path);
If in that case we have the file inside our project (same directory),then we dont need to add the path, just the file name and extension (ex: .txt)......I guess in your case it would be something similar.