Need help to get a set of files from a jar file running in Intellij community version on Ubuntu Linux

Answered

I'm completely lost concerning procedure; am new at Java and Intellij IDE.

In 64-bit Ubuntu Linux 18.04 OS I used the Archive Manager to extract all files in a .jar file to folder X.

There are 6 folders, an xx.db file and a README.md file.

These folders contain .java files and their associated .class files.

One of the folders has only a MANIFEST.MF file in it.

One of the folders has a .java file with the main class in it.

I would like to change and compile only the .java file with the main class in it while leaving all the other folders  with .java and .class files untouched. Is there a way to do this? Must I place everything but the ,java file in a .jar file to accomplish this? I still wouldn't know how to set up everything in IntelliJ to make this work.

I need to know the exact step by step procedure to get this done so I can step through the .java main class and also through other classes in other folders so I can see where to change the code.

Currently, I've been using the command line in a terminal to compile a single .java file, and then putting everything back in a .jar file and executing the .jar file using "java -cp /home/nexus/Documents//SQ_LANTERN_MODS/sq_lantern1.jar lantern.Lantern" because there were MANIFEST.MF problems otherwise.

It would be nice to run the app in Intellij and step through the code instead of using print statements by running everything with command line in a terminal.

2 comments
Comment actions Permalink

I am using the Community version of IntelliJ version 2020.1.1, Build #IC-201.7723.91m built on April 29, 2020. Using OpenJDK 11.

0
Comment actions Permalink

Hi, 

You need to upack all files from jar to a folder, then open this folder as project in IntelliJ IDEA, so everything is running from IntelliJ IDEA without jar files. 

Then you need to create an artifact for this project (https://www.jetbrains.com/help/idea/working-with-artifacts.html#artifact_def). This way, IntelliJ IDEA will pack the jar on every build. 

0

Please sign in to leave a comment.