jar

Safe class imports from JAR Files

一个人想着一个人 提交于 2020-01-15 10:06:27
问题 Consider a scenario that a java program imports the classes from jar files. If the same class resides in two or more jar files there could be a problem. In such scenarios what is the class that imported by the program? Is it the class with the older timestamp?? What are the practices we can follow to avoid such complications. Edit : This is an example. I have 2 jar files my1.jar and my2.jar. Both the files contain com.mycompany.CrazyWriter 回答1: First, I assume that you mean that the same

How do I get an Icon on a .jar file?

痞子三分冷 提交于 2020-01-15 09:45:42
问题 I have written a program in java, and I am able to execute it as a jar file. I was wondering two things. one, how would I make the .jar file have a desktop icon other than the standard java icon. and two, I am using netbeans, how would I create a .exe file instead of a .jar file? 回答1: Like Kitsune said, you can make an executable file. The Java packager I'm most familiar with is Launch4J. It's highly configurable and can be called from Ant scripts, so it can easily integrate into an existing

Cannot read an image in jar file

て烟熏妆下的殇ゞ 提交于 2020-01-15 08:15:52
问题 when i build a jar file and run it ,it shows a null pointer exception due to imageicon not found new ImageIcon(getClass().getClassLoader().getResource("icons/exit.png"))); this is the error what i get when i run the jar file Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(Unknown Source) at mediaplayer.MediaPlayer.buildtoolbar(MediaPlayer.java:130) at mediaplayer.MediaPlayer.<init>(MediaPlayer.java:81) at mediaplayer.MediaPlayer.main(MediaPlayer.java

Java: opening a resource (txt file) which is in a jar with OS standard application

烂漫一生 提交于 2020-01-15 07:47:45
问题 i get the error "AWT-EventQueue-0 java.lang.IllegalArgumentException: URI is not hierarchical". -I'm trying to use the java.awt.Desktop api to open a text file with the OS's default application. -The application i'm running is launched from the autorunning jar. I understand that getting a "file from a file" is not the correct way and that it's called resource. I still can't open it and can't figure out how to do this. open(new File((this.getClass().getResource("prova.txt")).toURI())); Is

Java: opening a resource (txt file) which is in a jar with OS standard application

早过忘川 提交于 2020-01-15 07:47:13
问题 i get the error "AWT-EventQueue-0 java.lang.IllegalArgumentException: URI is not hierarchical". -I'm trying to use the java.awt.Desktop api to open a text file with the OS's default application. -The application i'm running is launched from the autorunning jar. I understand that getting a "file from a file" is not the correct way and that it's called resource. I still can't open it and can't figure out how to do this. open(new File((this.getClass().getResource("prova.txt")).toURI())); Is

Java: opening a resource (txt file) which is in a jar with OS standard application

ε祈祈猫儿з 提交于 2020-01-15 07:47:06
问题 i get the error "AWT-EventQueue-0 java.lang.IllegalArgumentException: URI is not hierarchical". -I'm trying to use the java.awt.Desktop api to open a text file with the OS's default application. -The application i'm running is launched from the autorunning jar. I understand that getting a "file from a file" is not the correct way and that it's called resource. I still can't open it and can't figure out how to do this. open(new File((this.getClass().getResource("prova.txt")).toURI())); Is

How to include an external jar file to aar file in Android

血红的双手。 提交于 2020-01-15 06:18:09
问题 I want to develop a solution that allows me to use an external jar library in an SDK generated in aar file for an Android project. What I have as inputs : SDK : "de.xx.sdk:xxx-android-v1.0.0" external library : "libs/xxxx-v1.0.0" what I found out in my investigation is how to exclude a library from project like the following : implementation('android.arch.work:work-runtime:1.0.0') { exclude group: 'com.google.guava', module: 'listenablefuture' } Is there something similar to write in gradle

What is ojdbc6.jar file?

人盡茶涼 提交于 2020-01-15 06:09:22
问题 For school project I had to make program in Java that uses data base and to do so I had to import to that project file ojdbc6.jar. I know that without it I couldn't use data bases but I don't really know what is this file. Could someone explain? How such file is called and what exactly is its purpose? 回答1: Simply stated, a JDBC driver is a suite of classes that map the functionality required by the JDBC API onto the functionality provided by a specific kind of database. Each database uses a

What is ojdbc6.jar file?

心已入冬 提交于 2020-01-15 06:08:06
问题 For school project I had to make program in Java that uses data base and to do so I had to import to that project file ojdbc6.jar. I know that without it I couldn't use data bases but I don't really know what is this file. Could someone explain? How such file is called and what exactly is its purpose? 回答1: Simply stated, a JDBC driver is a suite of classes that map the functionality required by the JDBC API onto the functionality provided by a specific kind of database. Each database uses a

Export a Java project without main method (with external jars) to Jar in Eclipse

不问归期 提交于 2020-01-14 12:59:13
问题 I have created a java project which only handles post and get request from a web api. I need to export it as jar file. The issue is I'm using external jar files such as httpcore-4.3.3.jar and gson-2.3.1.jar. I have seen many solution to export as runnable jar , Since I don't have any main method how can I export my utility java project to jar file. My issue is I'm unable to export my project which has no main method as JAR along with my library files in eclipse. Thanks in Advance Edit Update