How to execute a .bat file with java program? [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How to execute a .bat file with java program?
Thanks in advance

bat files cannot be converted directly to jar files.
But you can implement bat file logic in a java application, using, for instance Apache Commons Exec and when it is compiled, package it as a jar file.

Do you know the rationale behind the question, the reason why they want you to do it ? Creating a jar requires development in java.
I think you need more information how the final application will be deployed. They probably have additional requirements which made them decide it could no longer be developed in a shell scripting language but requires a real programming language.
Make sure you understand the 'why?' before thinking about the 'how?'.
good luck

Related

How can I make project in java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 months ago.
Improve this question
We have to do java project like a management system and we have source code but the question is how to run it and where? anyone knows?
Queries
IDE
How to run it?
If you already have the source code,
Open a command prompt window then cd to the directory where you saved the java program.
For example, JavaProgram.java is in C:/
Type 'javac JavaProgram.java' and enter to compile your code.
Now type 'java JavaProgram' to run your program.
You will be able to see the result printed on the window.
Good luck :)
we have source code
You'll need to compile it.
Then you need to execute it. That could involve web containers with WAR or standalone, executable Java JARs, or directly execute a class file. Without seeing your code it's hard to answer that, but you wouldn't use an IDE to actually deploy/run your code outside of individual development.
You'll also need some server to run it on. That's not unique to Java.
Regarding the original question: "Make a project" - you could use Maven Archetypes or Spring and Quarkus have project starter websites, for example...

What is the java equivalent for Perl's require command? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am completely new to cgi concepts.
I'm given a task to convert a Perl cgi script to Java program.
I understood that the require 'file.ext' command in Perl includes the file available for code in the Perl script.
Because of the very limited resources and improper documentation I couldn't find any proper info.
Is there any Java equivalent to do the same action that require in Perl does?
The paradigms do not map at all. In Perl, require simply reads a file and runs the code in it, and everything else happens as side effects of that. In Java, your code must be compiled, and classes are included automatically when you compile your program. See Extend a java class from one file in another java file for more answers on this topic.

the purpose of .bak files in java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am new to Java development and just saw a file with .bak extension that looks like a java class but it is not. So I am wondering what is the purpose of the .bak files in general and why and when should I use it?
There is no special purpose for java files (or tooling here).
bak typically resorts to backup.
Such files get generated by various tools. These tools create bak files to avoid overwriting your original file. So there is no specific notion towards "java technology" here.
Simply look into the tools (mainly: your editor), and see if their help tells you about automatically creating backup file. The old Windows notepad editor did that for example.

Where should I move Java library jar files that I downloaded? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have just downloaded a java library. It is zip file. After extracting I have found that it consists of jar files. Now what am I supposed to do with it? Where do I copy these files so that I can access them from the java code.
The is an excellent answer to that in a related question.
Basically you tell the compiler and/or the runtime explicitly where the jars are.
Good luck!
Actually, you can extract your libraries where ever you want, but I you have to pass their path as an arguments to the java and javac commands in order to compile and to run your application

What is the hook to detect if a file or a folder was updated? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am looking for the right "Hook" on Mac OS X, Linux and Windows to detect when a folder and/or file gets updated.
I am using JAVA and Object-C for the MAC.
Thanks in advance.
Also if you have any tips to go on doing this, will be truly appreciated.
Thanks in advance.
On Linux you should look at inotify
I'm not aware of any Java library that does this stuff - especially not cross platform.
On Windows the Win32 API offers such functionality though with the ReadDirectoryChanges or FindFirstChangeNotification function.
Writing a small c wrapper that's called per JNI seems not too hard - the problem is probably finding out how to implement the basic featureset that can be supported by all three platforms.

Categories

Resources