How to add jar file in VS Code in my project? - java

I am trying to use VS Code to do a javafx project. I just figured out that javafx isn't built in in Java 13.(However, I remember that it is included before?)
So I download the javafx sdk and try to add the jar files into my project. I have added codes like<classpathentry kind="lib" path="lib\javafx-swt.jar"/> into the .classpath file. And the Java Dependencies also shows the included jar files. However, when I compiled the program it will show package does not exist. I'm wondering if I took any wrong step adding these jar files?
This is what my javafx code look like
The .classpath file and error message

Related

Marytts export voice to executable jar

I am currently trying to use marytts in my project. Now I am trying to export my project to an executable jar file. The problem is I always get this error:
java.lang.IllegalArgumentException: No such voice: bits3-hsmm
In IntelliJ everything works fine, the error only occurs when executing the exported jar file. I added the dependencies as shown in this photo
The marytts interface is working correctly only the voice makes troubles. A am using an downloaded version of the voice and marytts and they should be included in my exported .jar file.
This looks like a product of IDEA-240253 (and related IDEA-116209).
IDE should be able to handle this automatically, but currently it isn't implemented.
You may keep separate JAR files and add them to the classpath of your JAR via Class-Path attribute in MANIFEST.MF file.

Jar linking issue in Scala

What i do:
1.I am running a scala project,When i added the java source code(java file) in to the project it run
2.I need to add the jar file the project instead of the java source file
3.So i created jar file for the java source file in eclipse and added the jar file in the scala project instead of the java source file
4.But it shows error,when calling the method in the jar file
5.When i added the jar which i created in the java project,it works
Things i need to know:
1.Is there any different ways to add jar(created in java) in the scala project?
2.Whether i need to create jar in any other way?

RobotFramework cannot import Java keyword library

I did some robot framework python examples with pybot, and referenced .py files as my library files. The folder structure I used was test/lib/myLib.py and test/test/myTest.robot, where /test was at the same level as the /src folder in my project in eclipse.
I then tried to do similar things with a java project using jython. I have /test/test/myTest.robot which imports the library ../lib/myLib.java. I even tried importing this file using RIDE, but it always shows up as red text, meaning the import failed. The specific message I get from using jybot on the command line is:
"Importing test library 'C:\Users\cody\git\myProject\test\lib\myLib.java' failed: ImportError: No module named myLib"
I read that I might need to add it to classpath, and I think in order to do so, I need to make it a .jar file. I'd rather not do all that if possible to just leave it as a .java file. I attempted to add the lib folder to the build path... By that I mean I added the /test/lib folder to the "Source folders on build path". I also exported the darn thing as a jar and added that as a library. All this was done from the project properties in Eclipse.
I'm pretty stuck... any ideas how to get this working?
Java being a compiled language, you need to compile your java Class before importing it with RobotFramework.
Normally, Eclipse would do that for you, and put the resulting .class files inside a bin repository. If not, you can issue the javac path/to/file.java command, and move the resulting .class file where you want it (somewhere referenced by the classpath.
From within the .robot file, you should have the line Library test/lib/myLib, without neither .java nor .class at the end.

Eclipse export libraries with non jar files

I'm facing a problem I have never had before when exporting my eclipse project with external library. I made a little program with spelling correction and I used the language tool library you can find here.
I put this library in the build path and correctly imported into my eclipse project. When I ask to export it into a runnable jar, Eclipse exports only the jar files into languageTool library, but this library contains also some txt and xml files. So when I try to launch the application from command line it gives me error because can't find this txt and xml files. I tried to add to my jar archive manually but obviously it doesn't work. How can I fix it?
Thanks for your time and forgive me for my bad english.

creating and running jar file with source

I write a very simple java program with two classes: Business and Main.
I want to create a jar such that if I email it to someone they can:
run the program (i.e. run the jar)
open the jar to view the source code.
the code can run on mac or windows
I have been using IDEs for so long I have forgotten how to do this.
I am using netbeans 7.x
EDIT:
I found the following way on Netbeans:
properties > packaging > exclude from jar file :: delete **/*.java
But when I try to execute the jar using
java -jar mybusiness.jar
it says
no main manifest attribute, in mybusiness.jar
But note that my jar has a main class. Am I missing a manifest file?
You can export a JAR file that includes the source code using Netbeans:
Right click on the project and select properties
Build -> Packaging
Remove Java files from the excluded files. And select build jar after compiling
It will create the jar file that includes the source code if it successfully compiles.
Well surely an IDE can do this too?. Just make some text files and put the source into them and drag them into the ide's. It's java so it should automatically run on all platforms. I am not sure what the problem is here?
This link explains how do u create manifest file and how do you specify your main class in manifest file as its necessary for executing jar.

Categories

Resources