the file created with the jarbundler from a jar has different behavior than the source jar - osx-yosemite

I create an mac app file from a jar using the jarbundler 2.3.
i am having the following issue:
when you access the application from the jar directly, it opens a
specific folder placed near the jar file, in the same folder with the
jar file
but
when you will access the application from the .app file created with the jarbundler from the jar file above, it
will open the mac user home folder instead of the folder opened by the above jar file
Ca you tell me what should I do to have the same behavior for the both files,the .jar file and .app file created with jarbundler 2.3 from the .jar file.?
The jar bundler that I used is located here:https://github.com/tenny1028/JarBundler/releases/tag/v2.3
and I followed the steps from this tutorial
https://www.youtube.com/watch?v=cxxnAGlHtrE to create .app files from the .jar files.

The latest release of JarBundler has an option to do this.
You can view it here: https://github.com/tenny1028/JarBundler/releases/tag/v2.4

Related

IntelliJ IDEA does not recognize JAVA source directory

Recently I imported the source code of Flink, but IDEA did not recognize the JAVA source directory, resulting in the failure of normal compilation and reading. I found that the generated .Iml file does not contain the JAVA source directory, I can manually mark the source directory. Flink's module has 188+, manual mark is too difficult, what should I do? Thank you
Pictures are as follows
You can try to do:
Close the project File | Close Project
Close the IDE.
Open the project directory in File Explorer and delete all .iml files and the .idea directory.
Re-import the project into IntelliJ from Existing sources.

Where does intellij idea save the local storage and preferences of libgdx (pc)

I started working with files, a simple operation of writing and reading files.
But i had an error when writing a file and now i have to fix it by hand.
Thats the problem, i don't know where is my file.
Also i would like to see the file i'm writing.
I am working with intellij idea 2016 1.4, maybe the file is complied in a jar?
Yes, i know that clearing cache its an option.
nothing here: https://github.com/libgdx/libgdx/wiki/File-handling
on the wiki link only talk about where you can find the ablolute path file but thats not my case. I get the file this way:
this.resolver = Gdx.files.local(path + "item"+ String.valueOf(weaponNumber) + ".txt");
String description = this.resolver.readString();
So.. where is the file? thanks
In the desktop version it saves the file in the assets folder inside your android module.
FileHandle file = Gdx.files.local("myfile.txt");
file.writeString("Test libGDX", false);
System.out.println(Gdx.files.getLocalStoragePath());
Output: D:\Dropbox\Projetos\Outros\gdxTest\android\assets\
The project folder in my computer is gdxTest.
In your case you have the path var so probably will be a folder inside assets folder.
But when you pack the desktop game into a jar file, the file will be created in the same folder where your game jar file is located. Usually yourProject\desktop\build\libs.
The difference is because when we configure the desktop project we set the Working Directory in the yourProject\android\assets\ folder. So to Android Studio it is the local folder of your project.

How to view contents of .adapter file in Worklight

I am trying to view the contents of an .adapter file in the bin directory of Worklight's Eclipse, is there any way to check this?
The .adapter file is just a .zip file. Rename the extension to .zip and extract it. You will then be able to review the contents of the archive.

How to change the path that jar files use in java Web Applications

I have written a java Servlet web application, using NetBeans 7.2.1. The program have some jar file libraries that I have attached to the project. The application runs fine using NetBeans and Apache Tomcat 7.0.27.
My problem is that some of the jar file libraries that I am using in the project, need to access to some folders and files. I put these folder and files on the same directory as the whole NetBeans project is. but I got this exception:
Exception: java.lang.RuntimeException: java.io.FileNotFoundException
So I used these codes to find out where should I put them:
out.println("current directory: " + new File(".").getAbsolutePath());
out.println("current directory: " + System.getProperty("user.dir"));
out.println("current directory: " + getServletContext().getRealPath(("/")));
So I figured out that the current working directory is:
C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.27\bin
My question is that how can I set different directory address for each web application? I have many web applications and some of them use the same resource file names. I can't just put all of them in one directory.
Please note that I don't have access to the source code of jar files to change the. I just need a way to set the absolute path that the jar files use.
I have the same problem when I put the WAR file on the unix server. The extracted WAR file is in this location on the server:
/data02/tools/Apache/Tomcat/apache-tomcat-6.0.37/webapps/BANNEROnline
But I figure I should put the resource folders and files in this path (moosavi3 is my username!):
/home/moosavi3
How can I change the path?
The working directory is the directory from which java.[exe,bin] is started. I assume the bin directory is where the tomcat start-up script is? If the jars are all using this working directory I don't believe there is a way to make different web-apps have different working directory, they're all loaded on the same jvm (java.exe) from the same working directory.
A working directory is the directory from which a binary is started, it is not some arbitrary value that you can change.
I suspect these jar files where meant to be run as standalone applications and expected the filesystem resources they are trying to access to be in the same location as themselves.
Any filesystem resources would have to be moved to the location of your java.exe so that the correct file path resolution can result from your jars.
Standard Servlet project requires external libraries to be placed in the 'WEB-INF/lib' directory under project root. You can search google for 'servlet directory structure' and do your own research for more information. Shared libraries between web applications can be placed in the 'lib' directory under tomcat root, they should be picked up by tomcat jvm. My recommendation would be to keep the dependencies project specific, because you may need different versions in different projects in the future.
Update:
Read this page on the tomcat documentation, it will explain exactly how the project should be structured, and how to add a library that will be shared across all web applications:
http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html
Update 2:
The following Stackoverflow link explains several options how to add a static file to your web application, that will available at runtime.
https://stackoverflow.com/a/2161583/940754
Update 3:
Add a path to the classpath using the project's manifest:
http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html

How to Add My Custom C++ Executable in Mac App Contents/MacOS Folder

I want to add a C++ Executable file to my App's MacOS Folder. The Executable file needs no plist or anything to run. It runs without any other files support. So i tried adding this file to my Xcode project , when i build my app, the binary resulted in Resources Folder.
The App is running fine, but i want the executable to be in Contents/MacOS folder. How to achieve this ..?
Create 'copy file' phase in your app's target.