I am trying to use deck2pdf which is a java program to make pdf out of javascript slides presentation.
I followed the installation process from github:
cloned the repo
made ./gradlew distZip which generated a .zip file in build/distributions/
unizpped this file deck2pdf-0.2-SNAPSHOT.zip in my JS project folder
this folder has the following content:
- deck2pdf-0.2-SNAPSHOT
- bin
- deck2pdf
- deck2pdf.bat
- lib
- deck2pdf-0.2-SNAPSHOT.jar
- groovy-2.3.2.jar
- itextpdf-5.5.1.jar
- jfxrt.jar
then, I call deck2pdf in the terminal from my project folder,
but it says : command not found
what am I doing wrong?
Instead of:
deck2pdf
You need to run
./deck2pdf
Related
I was able to run the JAR file inside IntelliJ when I do Shift + f10.
However when trying to execute the JAR file from my directory, nothing happens. My META-INF is place as followed here: https://stackoverflow.com/a/49147689/12973878.
This is my JAR structure
JAR structure
File structure Image
Image
Can I know what is the problem here?
Based on the description, I assume you're in a windows environment. Try to run it in terminal. Change the current directory to the location of the file and the terminal command you need to give is:
java -jar <jarfilename>
Some suggestions:
Use the -verbose:class option when starting the java application to determine if classes are loaded from the correct places.
See if there's additional settings in the run configuration of IntelliJ. You'll find it in the upper right corner of the editor window next to the executuin button - dropdown will show 'Edit Configurations'.
If there's really no error at all - are you sure you have the correct starting Class as entry point? You might simply be executing the wrong main method from terminal while
IntelliJ picks the correct one (look for "main class" in run configuration).
After running a build for the project (or a mvn package) your jar is placed in <your_project_path>/target.
There you will find: <your_project_name>-0.0.1-SNAPSHOT.jar. Now just open command prompt (on win) / terminal (on mac).
Go to the project path
cd <your_project_path>/target
and run
java -jar <your_project_name>-0.0.1-SNAPSHOT.jar
Don't forget to check that you have java path in your system $PATH
run to verify
java -version
I have a simple Java backend build with Maven. When I create .jar file with mvn clean install, I can run it and everything works fine.
However, when I deploy it to Docker, the server runs, but when I make a GET call, the backend doesn't see static .png file located in src/main/resousces/.
java.io.FileNotFoundException: /src/main/resources/logo.png (No such file or directory)
The image is uploaded to docker with this .gitlab-ci.yml file:
services:
- docker:dind
before_script:
- docker info
maven-build:
stage: build
tags:
- maven3-jdk11
except:
- tags
script:
- mvn deploy -B -U
maven-release:
stage: deploy
tags:
- maven3-jdk11
only:
- tags
script:
- mvn deploy -B -Prelease-profile -Dmaven.javadoc.failOnError=false
(This is my first time working with Maven and Docker, so if the information I provided is not sufficient, please leave a comment.)
Okay, I managed to solve it using java ClassLoader.
Originally, I loaded the .png file like this:
Image logo = new Image(ImageDataFactory.create("src/main/resources/logo.png"));
I changed that to following and now it works like charm:
ClassLoader classLoader = getClass().getClassLoader();
Image logo = new Image(ImageDataFactory.create(classLoader.getResource("logo.png")));
I accepted Eugene's answer to boost his reputation, he moved me in the right direction.
Unpack your jar file and check if .png file in it. If not, you need to package a jar with the resources folder. If yes, so you need to specify the path to file using classpath.
I am relatively new to Apple OS and thus am not able to figure out as to how do I download, install then set up Java speech jar files and set up the classpath.
I tried everything possible from
Downloading FreeTTS,jsapi and trying to add the jsapi.jar to /library/extensions folder
Trying to use chmod command
Trying to open the jar file (which returned an error and asked me to check console)
Tutorials asking me to drop jar into the "lib" folder (I can't really figure out what and where is the "lib" folder in mac)
Basically I want to use all the capabilities of javax.speech in my Java programs.
JSAPI is pretty much abandoned, you won't be able to get lot from it. If you want text-to-speech use OpenMary directly without JSAPI, it provides a good selection of modern voices.
Download FreeTTS. Extract. Open the extracted /lib folder. chmod +x ./jsapi.sh and afterwards sh ./jsapi. Read the BCEL and accept.
Accept (y/n)?:
y
sed: --print-text-domain-dir: No such file or directory
x - creating lock directory
x - extracting jsapi.jar (binary)
As you can see there is the jsapi.jarbeing extracted into the lib folder (which was not there before). Now you can add the lib folder (it says it will be enough to point to the lib/freetts.jar) to your class path of any application that is using FreeTTS.
You could add it into some directory in your userspace folder and add to your ~/.bash_profile the line export JS_API_HOME=~/the/path/lib where ~/the/path would be where you stored the extracted archive. Then, you have to add the environment variable $JS_API_HOME to every build/classpath where you want to use the library.
For example, java -cp $JS_API_HOME -jar moep.jar
I'm facing difficulties on adding a JFreeChart library on my Java project (I use Windows 8). This is what I've already done:
1 - Unzipped JFreeChart
2 - renamed the archive jfreechart - 1.0.19 to jfreechart
3 - Added it's path to classpath: .;C:\Users\Victor\Desktop\projects\EP2 - IA\jfreechart - 1.0.19\lib\jfreechart.jar;
4 - Added in the beggining of my Java file: import jfreechart.*;
5 - Copied the jfreechart archive to the same directory of my project
But when I try:
java -classpath jfreechart.jar MyClass.java
it returns that the "jfreechart package does not exists"
As I'm an old school programmer that still uses Notepad, I've found nothing useful on Google about it.
You are using the wrong import statement. Try this instead:
import org.jfree.*;
You also may need the following library:
jcommon-1.x.y.jar
For future reference, you can view the contents of a JAR file using the command line jar command:
jar -tvf jfreechart-1.0.19.jar
I'm aware that this answer is a generally-accepted method for attaching sources for 3rd party JARs in Eclipse. However, I'm following the instructions and they're not working for me.
I'm trying to attach the source for JASIG CAS (version 4.0.0, so the CAS-4.0.0 link). When you download and extract this ZIP, it has the following directory structure:
cas-server-4.0.0/
cas-management-webapp/
...lots of source files
cas-server-core/
src/
main/java/
...lots of Java sources --> these are the .java files I want to attach as source
site/
test/
pom.xml
...lots of other dirs that start "cas-server-*"
So the CAS project consists of a bunch of JARs; the main one being cas-server-core. I want to attach the Java source for this JAR only. However, there is no compiled cas-server-core-source.jar here, just the exploded source files.
I'm looking for the exact instructions for attaching these sources so that when I run a debugging session in Eclipse, the debugger can find the sources and jump into them.
So far, I've tried:
Right-click my project >> Properties >> Java Build Path >> Libraries >> Add External JARs
I then selected the cas-server-4.0.0-release.zip. Then:
Under cas-server-4.0.0-release.zip Library, Select "Source attachment" >> Edit >> External location >> select the location of the cas-server-core/src directory
This isn't working. I'm wondering, do I need to first compile a cas-server-core-source.jar? If so, what does the directory structure of that JAR need to be.
In any event, how do I actually go about attaching the source for this JAR?
I just tried it in my workspace and was able to resolve the source files properly. The trick is that when you select the external location, you should pick the 'external Folder' instead of 'External File'.
I selected the External Folder with path cas-server-4.0.0/cas-server-core/src and it worked.