I got a jar file, and I know a class name in it for sure.
I need to know, in case this class file is in folder inside that jar, a command #Unix, in which I can see the full path of that class file where in that jar.
Thanks.
Try doing
jar tf TicTacToe.jar
For additional information you can do
jar tvf TicTacToe.jar
Related
To do a test, I have to add a jar file into a Java war file I've created with Maven. The war file works itself fine.
To insert my lz4-java-1.6.0.jar into application-metier-et-gestion.war on internal zip folder /WEB-INF/lib, I use this command :
zip -b WEB-INF/lib application-metier-et-gestion.war lz4-java-1.6.0.jar
But I receive that error message :
zip warning: expected 354 entries but found 84
zip error: Zip file structure invalid (application-metier-et-gestion.war)
I can do and redo mvn clean install it will always create a runnable war that seems perfect to me, but that zip declares invalid. Who is wrong ?
I case zip would be going wrong, what is the workaround to do what I want ? Is there a way through another tool ? tar ?
I case Maven would be going wrong and create a bad war file each time, how to detect the part it is creating wrongly ?
right click the war file ,rename the file extension war into zip
example :
test.war -> test.zip
As far as I can see you tried to add an additional library to the archive.
JAR files and WAR files are plain ZIP files. There is only one rule you have to obey, library files must not be compressed.
If you want to add JAR files to a JAR or WAR file, disable compression for the specific file to be added.
How can I load XML files in Spark 2.0?
val rd = spark.read.format("com.databricks.spark.xml").load("C:/Users/kumar/Desktop/d.xml")
I'm getting error com.databricks.spark.xml not available.
java.lang.ClassNotFoundException: Failed to find data source: com.databricks.spark.xml. Please find packages at https://cwiki.apache.org/confluence/display/SPARK/Third+Party+Projects
at org.apache.spark.sql.execution.datasources.DataSource.lookupDataSource(DataSource.scala:148)
at org.apache.spark.sql.execution.datasources.DataSource.providingClass$lzycompute(DataSource.scala:79)
at org.apache.spark.sql.execution.datasources.DataSource.providingClass(DataSource.scala:79)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:325)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:149)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:132)
... 48 elided
ClassNotFoundException means that you need a fat jar which you could include the package in your build.sbt and make the jar by sbt assembly. you may have a try.
If can not work. add the jar into $SPARK_HOME/jars and have a try.
Alternatively, you can add the jar file into your spark shell. Download the spark-xml_2.10-0.2.0.jar jar file and copy into the spark's class path and add the jar file in your spark shell using the :cp command as
:cp spark-xml_2.10-0.2.0.jar
/*
jar file will get imported into the spark shell
now you can use this jar file anywhere in your code inside the spark shell.
*/
val rd = spark.read.format("com.databricks.spark.xml").load("C:/Users/kumar/Desktop/d.xml")
Please, provide simplest way to convert .groovy-script to executable file .exe for windows-platform or .jar, for using on multiply platforms.
Thanks
Jar
This project is a simple card game, written in Groovy. It is uses a Gradle script to build a zip file that can be executed like so:
unzip warO.zip
java -jar warO.jar
See this segment of the build.gradle file to see how the manifest is specified for the jar (i.e. the classpath, main class entry point, etc):
jar.archiveName 'warO.jar'
jar.manifest {
attributes 'Main-Class' : 'net.codetojoy.waro.Main'
attributes 'Class-Path' : 'jars/groovy-all-1.6.4.jar jars/guava-collections-r03.jar jars/guava-base-r03.jar'
}
Exe
For an exe, consider a tool such as JWrapper.
I opened a jar file in jd-gui but when I try to save the all resources it stops working. I don't know where to look for the logs of jd-gui.
How can I save all the decompiled source files?
I met the same problem, and resoled it as below:
unzip the target jar file.
remove unnecessary folder
zip the remaining class files into a new-small jar file.
download the jd-cli project from here: https://github.com/kwart/jd-cli/releases/tag/jd-cli-1.2.0
use jd-cli to de-compile the jar , and with the log option, e.g.
jd-cli target.jar -od jar_result -g ALL
check the output log and find out which block.class file block the de-compile proccess. if there is, then remove it from the target.jar and then re-run the jd-cli again. You can manually copy/paste the block.class source code from jd-gui.
Open "jd-gui.cfg" with a text editor. "LastUri", in section "Decompilation", contains the name of the CLASS file causing the crash. A workaround is to open the JAR file and remove or change extension of this CLASS file.
Regards.
It seems a bug. I solved it simply trying to export sources to other folder ($home -using debian-)
I have made jar file for my application. One of the class of my application uses BouncyCastleProvider class of BC jar.
I have created one folder "lib" in the same parent folder where my application jar is residing.
I have changed my machine CLASSPATH to point to this new lib folder. But when I run my application it gives me classnotfound exception.
But if I copy this BC jar file to my jre/lib/ext then everything works fine.
Can anybody tell me what I need to do to access BC jar file from my lib directory?
Thanks in Advance,
Jenish
Your JAR file must have its MANIFEST.MF file set to declare the classpath for the JAR.#
Extract from the Sun Tutorial below, in your case you just need to make the Class-Path directive point to your lib directory, presumably
Class-Path: lib/BouncyCastle.jar
We want to load classes in MyUtils.jar
into the class path for use in
MyJar.jar. These two JAR files are in
the same directory.
We first create a text file named
Manifest.txt with the following
contents:
Class-Path: MyUtils.jar
Warning : The text file must end with a new line or carriage return.
The last line will not be parsed
properly if it does not end with a new
line or carriage return.
We then create a JAR file named
MyJar.jar by entering the following
command:
jar cfm MyJar.jar Manifest.txt MyPackage/*.class
This creates the JAR file with a
manifest with the following contents:
Manifest-Version: 1.0
Class-Path: MyUtils.jar
Created-By: 1.6.0 (Sun Microsystems Inc.)
The classes in MyUtils.jar are now
loaded into the class path when you
run MyJar.jar.