Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does anyone help me compile the jar in linux #32

Closed
hirios opened this issue Sep 1, 2019 · 8 comments
Closed

Does anyone help me compile the jar in linux #32

hirios opened this issue Sep 1, 2019 · 8 comments

Comments

@hirios
Copy link

hirios commented Sep 1, 2019

Does anyone help me compile the jar in linux? I'm new to python, and I still know less about java, how can I compile .jar on linux? (if possible)

@kellerkindt
Copy link

  1. Have a jdk & maven installed
  2. Navigate to the java directory
  3. execute mvn package
  4. Find the jar at target/*.jar (probably target/Anime4K.jar)
  5. Execute the jar (probably java -jar target/Anime4K.jar)

@upbit
Copy link

upbit commented Sep 8, 2019

I compiled with my macos, it should work under linux too (requires JDK12)
https://drive.google.com/file/d/1I1bTTtNtT2VhpXJMXawAS4ekYOSnRrKC/view?usp=sharing

@AaronFeng753
Copy link

  1. Have a jdk & maven installed
  2. Navigate to the java directory
  3. execute mvn package
  4. Find the jar at target/*.jar (probably target/Anime4K.jar)
  5. Execute the jar (probably java -jar target/Anime4K.jar)

Hey, do you have a compiled jar for windows?? I tried to compile one, but there are a lot of exceptions.

@kellerkindt
Copy link

  1. Have a jdk & maven installed
  2. Navigate to the java directory
  3. execute mvn package
  4. Find the jar at target/*.jar (probably target/Anime4K.jar)
  5. Execute the jar (probably java -jar target/Anime4K.jar)

Hey, do you have a compiled jar for windows?? I tried to compile one, but there are a lot of exceptions.

Nope, I also compiled it on Linux

@ddouglas87
Copy link

Doesn't seem to be working for me:

git clone https://github.com/bloc97/Anime4K.git
cd ~/Anime4K/java/

bunny@Lovely:~/Anime4K/java$ mvn package
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.mycompany:NextGenAnimeEnhancer:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-jar-plugin @ line 49, column 17
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] -----------------< com.mycompany:NextGenAnimeEnhancer >-----------------
[INFO] Building NextGenAnimeEnhancer 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ NextGenAnimeEnhancer ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/bunny/Anime4K/java/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ NextGenAnimeEnhancer ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/bunny/Anime4K/java/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ NextGenAnimeEnhancer ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/bunny/Anime4K/java/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ NextGenAnimeEnhancer ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ NextGenAnimeEnhancer ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ NextGenAnimeEnhancer ---
[INFO] Building jar: /home/bunny/Anime4K/java/target/NextGenAnimeEnhancer-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.784 s
[INFO] Finished at: 2019-09-19T20:56:49-07:00
[INFO] ------------------------------------------------------------------------

cd target/
bunny@Lovely:~/Anime4K/java$ ls target/
classes  generated-sources  maven-archiver  maven-status  NextGenAnimeEnhancer-1.0-SNAPSHOT.jar

bunny@Lovely:~/Anime4K/java/target$ java -jar NextGenAnimeEnhancer-1.0-SNAPSHOT.jar 
Exception in thread "main" java.lang.NoClassDefFoundError: com/aparapi/Kernel
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at com.bloc97.anime4k.Main.<clinit>(Main.java:24)
Caused by: java.lang.ClassNotFoundException: com.aparapi.Kernel
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 10 more

I'm on Mint 19.2 (Ubuntu 18.04) using java 12.0.2 2019-07-16 and Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T08:06:16-07:00)

@Smarthard
Copy link

Smarthard commented Sep 22, 2019

1. Have a jdk & maven installed

2. Navigate to the java directory

3. execute `mvn package`

4. Find the jar at `target/*.jar` (probably `target/Anime4K.jar`)

5. Execute the jar (probably `java -jar target/Anime4K.jar`)

You missed step 2 and a half: mvn install. So full steps would be:

  1. Have a JDK 12 & maven installed
  2. Navigate to the java directory
  3. execute mvn install
  4. execute mvn package
  5. Find the jar at target/NextGenAnimeEnhancer-1.0-SNAPSHOT.jar
  6. Execute the jar java -jar NextGenAnimeEnhancer-1.0-SNAPSHOT.jar [File_In] [File_Out] (Scale) (Push_Grad_Strength) (Push_Strength)

P.S. It can be done on Windows as well.

@ddouglas87
Copy link

Seems to be working, somewhat.

bunny@Lovely:~/Anime4K/java/target$ java -jar NextGenAnimeEnhancer-1.0-SNAPSHOT.jar '/home/bunny/Desktop/test_original.png' '/home/bunny/Desktop/test_a4k.png'4
after clEnqueueNDRangeKernel, globalSize[0] = 1030000, localSize[0] = 256
!!!!!!! clEnqueueNDRangeKernel() failed invalid work group size
Sep 21, 2019 8:29:29 PM com.aparapi.internal.kernel.KernelRunner fallBackToNextDevice
WARNING: Device failed for ImageKernel, devices={NVIDIA<GPU>|Java Alternative Algorithm|Java Thread Pool}: OpenCL execution seems to have failed (runKernelJNI returned -54)
com.aparapi.internal.exception.AparapiException: OpenCL execution seems to have failed (runKernelJNI returned -54)
	at com.aparapi.internal.kernel.KernelRunner.executeOpenCL(KernelRunner.java:1263)
	at com.aparapi.internal.kernel.KernelRunner.executeInternalInner(KernelRunner.java:1712)
	at com.aparapi.internal.kernel.KernelRunner.executeInternalOuter(KernelRunner.java:1383)
	at com.aparapi.internal.kernel.KernelRunner.execute(KernelRunner.java:1374)
	at com.aparapi.Kernel.execute(Kernel.java:2897)
	at com.aparapi.Kernel.execute(Kernel.java:2854)
	at com.aparapi.Kernel.execute(Kernel.java:2829)
	at com.bloc97.anime4k.ImageKernel.process(ImageKernel.java:71)
	at com.bloc97.anime4k.Main.main(Main.java:60)
Sep 21, 2019 8:29:30 PM com.aparapi.internal.kernel.KernelRunner fallBackToNextDevice
WARNING: Trying next device: Java Alternative Algorithm

I have OpenCL installed and have used it in Waifu2x projects successfully.

@hirios
Copy link
Author

hirios commented Oct 5, 2019

Thank you all! <3

@hirios hirios closed this as completed Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants