convert war file to exe file [closed] - jar

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have a file in .war format.
Is it possible to convert it to an .exe or .jar file?

First of all why you need to do such thing?
As stated on wiki :
A war file is a JAR file used to
distribute a collection of JavaServer
Pages, servlets, Java classes, XML
files, tag libraries and static Web
pages (HTML and related files) that
together constitute a Web application.
A war file is you application which is ready to run on server. As you said you are using tomcat you just need to put the war file in webapps folder of tomcat. And start the tomcat server. Its done. Your project will successfully run. No need to build exe [of war] for this.
If you wanna give client a setup that will look like set up and setups all things to run your app then you can use a exe maker software (like installJammer)and make your exe such that it includes tomcat with your war in webapps. Make shortcut to startup file of tomcat. So now when user clicks on shortcut tomcat will start and with it your application will also start and user can access it on browser.

Both war and jar are ZIPs. Thus, they can be easily converted.
However, wars usually store webs, while jars contain desktop programs.
So, converting a war to a jar would not be useful because, as the war contained a web, the converted jar will also contain a web, so trying to run it (as a program) will cause an error.
If you're looking to convert a web (the war) into a desktop app, this is not the way.
Please, take a look at Prism.

.war files are intended to be run inside a web container. So what you might want to do it to put the .war file in one, and run the web container from the task scheduler. I've done something like this before (although not with a task scheduler) using Jetty. Jetty itself is a java program, so you just start it by running java.exe -jar start.jar in the Jetty directory.

Yes, you can covert a war into a jar file by just changing the suffix.
Both wars and jars have the same basic format (they're ZIP files), but wars usually have dependent jars and a web.xml file that describes the application.
Jars and Wars contain Java class files and need a Java engine to run. However, I suspect there are tools out there that can package a JRE, with a lightweight server (if one is needed) and the war/jar file into a single "exe" file for Windows.
I just Googled java Windows exe wrappers and found the top four results looking pretty much like what you're after.

Related

Path to the project current dir in qt

I want to get a path to the project directory in Qt and reference the other files of my project relative to it. I know this issue have been already discussed here
Get current working directory in a Qt application
and here
How to get current working directory path of a Qt application?
but the answer is still unknown. In case it's impossible to get such a path then what is the approach of navigation among files of the Qt project.
Based on your comment, you are trying to:
Access some images which are being used in my program. I could of course put them into build target directory, but it becomes uncomfortable to pass my code to others.
The approach to store resource files in the project source directory and rely on such structure at runtime is not a greatest idea. I can't imagine the situation when mixing the concepts of initially decoupled source and build directories could be useful, correct me if I'm wrong.
So, according to your needs:
The most simple and plain way is to use the Qt resource system. The resource files are simply embedded into the executable, so there will be no need to access the file system.
Another way is the automatic deployment of the needed files. This answer describes the way to copy your files to the target directory using qmake.

Running exe in QtCreator has different working directory than outside QtCreator [duplicate]

This question already has answers here:
Used current working directory by mistake... Where the heck is my database?
(3 answers)
Closed 6 years ago.
when I compile and run an application inside QtCreator, the current working directory is the build directory, i.e. the folder named "build-MyProject-Desktop_Qt_5_4_0_MSVC2013_32bit" in my case, but this isn't the directory the exe resides in. The exe can be found in the debug or release subdirectory, which is the "current working directory" when I run the exe outside of QtCreator. How can I make QtCreator use this path as current working directory as well? I already tried to change the directory under "Projects" in my Run settings, but it looks like I can't use different directories for the debug and release builds.
edit: Calling this a duplicate is a bit far fetched in my opinion, because the "duplicate" refers to creating a DB, while mine refers to weird behavior from QtCreator. The question I actually asked was how to change QtCreator's properties, because it's weird to call my exe from a parent folder. Visual Studio never did that to me. The lesson (don't use the current working directory unless you explicitly set it) may be the same, but the questions were completely different, so I had no way of finding a solution to my problem by searching stackoverflow instead of asking.
If you want your program to always use the location of executable as its working directory, then you can just do that from inside the application code
QDir::setCurrent(QCoreApplication::applicationDirPath());
If you need to find files relative to your executable, it is not a good idea to rely on the Current Working Directory, which is determined by where your program is called from, not where the executable file lives.
To find the location of your executable, use QCoreApplication::applicationDirPath. Note that this is still a bit flaky with respect to cross-platform portability, as e.g. Unix or MacOS will tend to put files related to your program in radically different locations than on a Windows PC by convention.
If I call your program like this:
some/subdir/yourprogram
the current working directory will not be some/subdir, and your logic will fail.
As the oposite workAround proposed by Kevin Krammer, you can change the working directory outside Qt Creator :
Admitting this configuration :
C:\buildDir\debug
C:\buildDir\release
Make a batch in C:\buildDir\launch.bat (for exemple) which launches your executable : release\yourexe.exe
This batch can be use sooner or later to specify some useful environment variables or log redirections.
(PS : I suppose you are under Windows regarding your compiler, but this works similarly on linux)

How to / where to find info on JBoss client dependencies? Any documentation?

It may be pretty basic question. But no luck Googling.
I was going through this URL. Because I had an issue accessing EJBs deployed on JBoss. After following this, it worked. Mainly this line.
jboss-ejb3-client.jar, jboss-aop-jdk50-client.jar, jboss-aspect-jdk50-client.jar and jbossall-client.jar -
all these .jar files are found in client folder of JBoss installation directory
But for a newbie of EJBs like me, this is following the steps without understanding the dependencies. So my question, can we find documentation like this somewhere? How do we know the jars we need to copy to client application classpath?
jbossall-client.jar for JBoss 4.X is enough - it contains all needed libraries.
For JBoss 5.X the story is more difficult - you need to reference in your project only jbossall-client.jar, but inside this JAR there are no actual classes, only MANIFEST file, which lists needed dependencies.
So, on JBoss 5, you need to have jbossall-client.jar added to classpath of your client plus all listed JARs lying next to it. Crazy, isnt't it?
JBoss 7 has sane approach. There is bin\client\jboss-client.jar that contains all dependencies needed by clients.

Run EXE's as JAR files? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I convert a JAR file to an EXE file?
Sorry if I sound like a newbie... But I am very new to the Java coding stuff.
Is there any way that you can convert an exe file to an executable JAR file? Like with Minecraft, there are a few versions of the launcher, some being JARs and some being EXEs. Please tell me if there is any way to run exes as JAR files, for example, the exe of GTA III or etc.
Files with a .exe extension simply imply that the file is an executable image, usually conforming to the Portable Executable standard. They consist of compiled code, native to the operating system and processor, in the form of assembly instructions that the processor can interpret. They may be originally written in almost any language - C, C#, C++, VB6, VB.NET, Delphi, x86 asm, Java, etc. For all intents and purposes (excluding .NET), you can't turn these into the original code.
JAR files are special archives containing compiled Java objects. These work in a similar way to executables, except they're handled by the Java Virtual Machine (JVM) rather than the operating system itself.
There's no way to turn compiled native code from an executable into a JAR. They're completely different concepts.

Defference between spring security JAR files?

I am integrating security to my web MVC application and couldn't get idea what I have to do (What JARS required for it), so after some googling i found this link
Now I have download spring security 2.0.4 from spring security web site. In spring-security-2.0.4\dist folder there is some JAR files. There is some file with minimum changes e.g
spring-security-xxx-2.0.4.jar
spring-security-xxx-2.0.4-sources.jar
Please some body explain to me what is the difference between them. And which one is better from two of them to choose.
Note My existing MVC application is on spring 2.5.
I know its a very newbie question but I am learning security. Thanks
Just to clarify, this isn't really a security related question but rather a general code packaging question.
Jar files are actually just zip files and therefore can contain anything.
By convention a jar name that ends with -sources contains source code i.e. the actual .java files.
Jar files without the -sources contain the compiled java byte-code i.e. all the .class files. Essentially the files that you get when you run the .java files from the corresponding -sources jar through javac.
You only need the compiled .class files at runtime. That is why the two are split.
The -sources jar is useful at development time so that you can inspect the code that you are calling. This is especially useful if you are using 3rd party code that isn't well documented.

Resources