Reference files in jar


















I am able to execute my code using eclipse. However i would like export my code as jar. I have 4 classes in my project. I have used default package. My Class references external jars. When packaged you can run the main class with the command java -jar jarfile. You do not have to specify the class name on the command line. Easier for anybody that could use your jar file.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Add a comment. Active Oldest Votes. It has an ant task which can simplify the building of it as well.

MF Main-Class: com. Main Class-Path: commons-logging. Improve this answer. From the official tutorial : By using the Class-Path header in the manifest, you can avoid having to specify a long -classpath flag when invoking Java to run the your application.

In my case, I have an Android application which I am using it as a jar file. This jar file in turn refers multiple other jar files. So I was trying to use this option. However I am stuck at this point.

I am not able to get the android configuration into launch configuration. This works perfectly and I don't understand why it is not better documented! Thank you very much Vogash! Really works. I was doing all kind of command line monkey business, and didn't know eclipse has it Thx for sharing — Peter. Post as a guest Name. Email Required, but never shown.

The Overflow Blog. Podcast Helping communities build their own LTE networks. Podcast Making Agile work for data science. Featured on Meta.

New post summary designs on greatest hits now, everywhere else eventually. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled.

Accept all cookies Customize settings. Active Oldest Votes. Improve this answer. Brandon Buck Brandon Buck 7, 2 2 gold badges 32 32 silver badges 50 50 bronze badges.

James Scriven James Scriven 7, 1 1 gold badge 29 29 silver badges 35 35 bronze badges. The API takes a string as the location of the file — jax. What API are you trying to use?

My point is that there is no file, only a bunch of bytes inside the jar. Most apis will allow you to specify the input as a stream rather than a file location, which is what you will need. Jeffrey Jeffrey 43k 7 7 gold badges 86 86 silver badges bronze badges. Community Bot 1 1 1 silver badge. OscarRyz OscarRyz k gold badges silver badges bronze badges. The file is definately inside the jar — jax. Sign up or log in Sign up using Google.



0コメント

  • 1000 / 1000