#jar

1 messages · Page 1 of 1 (latest)

sturdy vigil
#

i cant add jar file with cmd

wanton yachtBOT
#

<@&987246399047479336> please have a look, thanks.

sturdy vigil
#

code :

#

build code : javac -cp "json-simple-1.1.1.jar" LoginFrame.java

signal linden
sturdy vigil
#

but i can't run

signal linden
#

isnt better to use a build system?

sturdy vigil
signal linden
#

in META-INF

signal linden
sturdy vigil
#

i try with jar but i can't start jar

sturdy vigil
signal linden
#

it will be easier

sturdy vigil
#

run code :

java -cp "json-simple-1.1.1.jar" LoginFrame
#

error :

error: Class names, 'LoginFrame', are only accepted if annotation processing is explicitly requested
1 error
#

i don't understand this error

signal linden
#

use java -jar

#

eg

#

java -jar json-simple-1.1.1.jar

#

now if there is an error saying there is no main class

sturdy vigil
#
 java -jar -cp "json-simple-1.1.1.jar" LoginFrame
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unable to access jarfile LoginFrame
wanton yachtBOT
signal linden
sturdy vigil
signal linden
#

create a jar first

#

before you use java

#

or do

#

java your.main.Class

sturdy vigil
#

i convert jar

#

but i cant open

signal linden
#

bro stop tryharding, if you have dependencies just use a buld system

#

eg Gradle

sturdy vigil
#

ok

signal linden
#

so thats the issue?

#

you cant open the file

sturdy vigil
#

this and i cant use jar

last bronze
signal linden
#
Exception in thread "main" java.lang.Error: Unresolved compilation problem: 

    at main.java.LoginFrame.main(LoginFrame.java:115)```
signal linden
last bronze
#

Then what are you doing

#

-_-

sturdy vigil
last bronze
#

Please just use maven or gradle

signal linden
#

yeah that what I was saying

#

@sturdy vigil it will make your life easier when programming in java

sturdy vigil
wanton yachtBOT
sturdy vigil
#

netbeans pom.xml

signal linden
bleak knoll
#

json-simple-1.1.1.jar is just part of your code

#
java -cp "json-simple-1.1.1.jar;your-code.jar" LoginFrame
#

or, if you are using java 22+

#
java -cp "json-simple-1.1.1.jar" src/LoginFrame.java
#

replace src/LoginFrame.java with wherever your code is