Jump to content

IntelliJ: Building a JAR artifact


dungeonqueer

Recommended Posts

I'm attempting to create an artifact with which I can export JAR files to my Osbot's script folder.

I create an artifact by going to the Project settings -> Artifacts -> Add -> Empty JAR

I set the location to C:\Users\...\OSBot\Scripts\ and click accept - This creates the Manifest.

I've set my Main-Class to my only class, which is a barebones class extending Osbot's abstract Script class. Below is the format of s

@ScriptManifest(name = "Test", version = 1.0, author = "Test", info = "", logo = "")
public class Test extends Script {
    @Override
    public void onStart() throws InterruptedException {
        super.onStart();
    }

    @Override
    public int onLoop() throws InterruptedException {
        return 0;
    }

    @Override
    public void onExit() throws InterruptedException {
        super.onExit();
    }

    @Override
    public void onPaint(final Graphics2D IIiiiiiIIiIi) {
        super.onPaint(IIiiiiiIIiIi);
    }
}

However, it says that this class cannot be used. Once I add a main() method stub to the class, there are no issues with building the artifact. This leads me to believe that in some way, it is not recognizing that this class has a point at which the Script will be able to start. The documentation along with posts on the forums prove this to be correct.

 

Have any of you been met with this? How did you resolve the issue? Thanks.

Link to comment
Share on other sites

I didnt understood very well what you doing but if you just trying to export the scripts to osbot folder:

File > Project Structure > Modules > Path > click "use module compile output path" > type in output path: "C:\Users\Your user name\OSBot\Scripts" and test output path: "C:\Users\Your user name\OSBot\Scripts and click Aplly.

To export the script just Right-click in any place of source and click Recompile or press Ctrl+Shift+F9

In my structure configurations have nothing in Artifacts.

Edited by RuneMaker4657
Link to comment
Share on other sites

11 hours ago, dungeonqueer said:

I'm attempting to create an artifact with which I can export JAR files to my Osbot's script folder.

I create an artifact by going to the Project settings -> Artifacts -> Add -> Empty JAR

I set the location to C:\Users\...\OSBot\Scripts\ and click accept - This creates the Manifest.

I've set my Main-Class to my only class, which is a barebones class extending Osbot's abstract Script class. Below is the format of s


@ScriptManifest(name = "Test", version = 1.0, author = "Test", info = "", logo = "")
public class Test extends Script {
    @Override
    public void onStart() throws InterruptedException {
        super.onStart();
    }

    @Override
    public int onLoop() throws InterruptedException {
        return 0;
    }

    @Override
    public void onExit() throws InterruptedException {
        super.onExit();
    }

    @Override
    public void onPaint(final Graphics2D IIiiiiiIIiIi) {
        super.onPaint(IIiiiiiIIiIi);
    }
}

However, it says that this class cannot be used. Once I add a main() method stub to the class, there are no issues with building the artifact. This leads me to believe that in some way, it is not recognizing that this class has a point at which the Script will be able to start. The documentation along with posts on the forums prove this to be correct.

 

Have any of you been met with this? How did you resolve the issue? Thanks.

 

You don't need to set a main class.

Just create an empty jar

Set the output directory to the scripts directory

Move your script's compiled output from the right hand side to the left hand side (in your .jar)

Link to comment
Share on other sites

On 9/23/2017 at 4:19 PM, Explv said:

 

You don't need to set a main class.

Just create an empty jar

Set the output directory to the scripts directory

Move your script's compiled output from the right hand side to the left hand side (in your .jar)

On a very similar note, just started using IntelliJ and am having trouble exporting a JavaFX project as a runnable jar with dependencies (external libs) into A SINGLE RUNNABLE JAR FILE. Exports the dependencies into the same folder as the jar, but not inside the jar itself.
In Artifacts -> Output layout tab: Dragging the eternal jars into the jar I want them to be in doesn't help. Still exports outside the jar.

If I do "Extract into Output root" on the desired library and then drag the extracted folders inside the "jar to be made" then all seems ok, but something messes up and the jar does't launch due to

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

Any ideas how to properly export a JavaFX project with dependencies into a single runnable jar?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...