简体   繁体   中英

Exporting java project from netbeans to executable jar

Used eclipse in the past fro java coding and didn't have many issues but decided to give netbeans a blast

I'm trying to create a jar file with all dependencies as one jar and yes am familiar with the java-web-start-option and also the jar actually exists in my dist folder once built.

Problem 1

All's good and well, I can launch the jar but seems not without its lib folder which contains: AbsoluteLayout.jar + beanbindings.jars. Something I will need to figure out as I go along.

I call a few batch scripts to complete differenet jobs for me in the java program eg one finds memory amounts and displays in a JTextArea. When I use the program within the netbeans ide all works fine.

Problem 2

When I launch the jar file thats in the dist folder it launches just fine but cannot find the batch/bash scripts at all. Below is the path I use within the program which as I mentioned works fine in the IDE and just wondering why it cant find the same path in the jar.

I assumed when I created and built like in eclipe it would make all these commands work in the existing jar in my dist folder (bin in eclipse ofc)?

    String[] filepath = {"cmd.exe", "/C", "..\\Enterprise\\src\\enterprise\\batch\\memory.bat"}

Any suggestions, thanks in advance!

Just try to change your path. Just make a flag if it's in your ide then select this path, if not then use another path. Try this link to get the application path in java.

Get the application's path

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM