Launch Minecraft 1.7.10 from command line - java

I've been trying to make a batch file in Windows to directly launch Minecraft 1.7.10. However, the method I tried had changed since the new launcher has been released. Does anyone know how I could directly launch it from the command line, with my username and session token? I legally own Minecraft, so I should be able to use my session token and username.

Try to run Minecraft 1.7.10 normally then use task manager or another program to get the command used to launch the program.

Related

OSX Catalina broke osascript launch with administrator priviledges

All known prior macOS versions were working with this sort of script context:
osascript -e "/path/to/my/app.command" with administrator privileges
Now it just silently fails...after asking for admin password.
The command file is what was originally used to launch the app, and the app has a button to re-launch with privileges...and the prior non privileged app closes.
If I remove the "with administrator privileges", it re-launches. if that is there, it does not.
If I try using:
/usr/bin/security execute-with-privileges /path/to/my/app.command
It also fails...never even shows password prompt.
I tried also "sudo open /Applications/myApp.app" but that of course doesn't actually launch with privileges.
From a shell i can sudo launch my app, and that is fine, but I can't expect an average user to be able to do sudo in a shell.
As I said, this had been a nice method that has worked for probably the past 6 to 8 years...but now fails. Anyone have any tricks or ways to get around it?
At one time....and I have no idea why, I saw the OSX security popup indicating "java" is not a trusted app and my settings only allow app store apps. But that only happened once...and it was strange. I clicked OK, it disappeared. I thought maybe java had been quarantined, so I did the command to clear that flag:
xattr -rd com.apple.quarantine /path/to/the/binary/java
But that made no difference. I'm sure this is new security features in Catalina making things difficult...but I can't figure out why or how to work through them. Its a java app that is launched via the app.command file which finds java on the machine and then launches it...defaulting to finding a local copy in its own subfolder.
Checkout out the sandbox settings of your project. the App Sandbox should be set as false in the entitlements file.
The sandboxing feature prevents your app from elevating the privilege in your app.
reference: https://developer.apple.com/app-sandboxing/

How to install Processing-Java in Windows 10?

I know that you can install processing-java using the tools menu in processing 3 app but it only works in macOS. In windows there is no option to install processing-java from the tools menu.
Furthermore, I tried installing using the 'processing-java.exe' in the installed folder ;
but it will just open a cmd window and it will get closed as soon as it pops up.
Additionally, I tried typing the command processing-java in cmd prompt and it says it isn't a command. Finally, can some tell me how to install processing-java.
You don't have to install anything, and processing-java.exe doesn't actually display anything. You need to run it via the command line, and you need to give it arguments to work.
Open a command line to the directory that contains processing-java.exe and then type processing-java.exe and hit enter. You should see an output of the arguments you can feed the tool.
Also note that 99% of Processing users never have to touch this tool, so make sure you actually need it before you try using it.
Without installing processing-java from the tool menu in the Processing app, you can still execute it in the console from anywhere using its full path, e.g. C:\Users\yourname\Documents\processing-3.4\processing-java.exe.
A command to run a processing sketch can be C:\Users\yourname\Documents\processing-3.4\processing-java.exe --sketch="C:\Users\yourname\Documents\sketchFolder" --run.

notepad.exe is not opening in tomcat but works in eclipse

My requirement is to open the notepad using processbuilder.
If we run the
C:\>notepad.exe
In command line or eclipse (through java using processbuilder )the process is created like below.
Name PID status UserName
notepad.exe 8380 Running Selva
The process is created in task manager and also notepad is opening and we can able to execute the command again and again.
But If we run the command from Tomcat using java process builder(Tomcat started through services.msc) the process is created like below.
Name PID status UserName
notepad.exe 8380 Running SYSTEM
The process is created in task manager.But notepad is not opening in the system and also we can't able to run the command again.Because it's showing,
"The process cannot be accessible,because it's being used by another process"
Why the process is created with the name "SYSTEM" instead of "Selva" in tomcat and why the notepad is not opening.
How to fix this issue?
Any help will be greatly appreciated!!
Services run in the background - regardless whether a user is logged on or not. Thus they usually have no access to the GUI. Windows redirects their GUI output to a 'hidden' desktop.
This problem is per Windows design and not related to Java. See also Swing JDialog is showing fine when I run it from eclipse but not working from windows service(services.msc)

running application from cmd as administrator through java code

I executed the netsh command from the CMD that was manually opened by me by right clicking the CMD icon from the start and then selecting run as administrator from the options.It worked fine.Now I tried to run the netsh command through my java code,then it is not working.Nothing is happening when i run that code.I want to ask that I can run applications like notepad.exe from the cmd by calling appropriate methods of the runtime class from my java code,But how can I open the same application with the administrator priviliges from my java code.r.exec("notepad"); where r is an object reference to the runtime class will run the application,but the notepad so opened will not be in administrator mode.Actually I guess that learning to run the application in administrator mode from CMD will be enough to do the work done as The corresponding CMD command will be passed as the argument to the exec() method of the Runtime class.So my questions are:
How to run any application from CMD in windows 8 with administrator privilliges?
The way i want to implement the use of netsh is a good thing to practise or there is some other way out i must use these commands from my java code.
I have seen some commands while googling but they where not working out for me,like runas /user:administrator "notepad.exe" etc.
Thanks
You cannot use the runas /user:administrator approach, as that requires a password input which you cannot provide from an external source (such as a Java application) for security reasons.
I had a similar issue to you in the past, and I solved it using PsExec, running the process on localhost with an administrator username and password allowed me to execute external applications as an administrator.
Using your example you could run:
PsExec.exe \\\\127.0.0.1 /accepteula -u USER -p PASSWORD notepad.exe
The "/accepteula" flag prevents the requirement to accept the EULA interactively when run on a machine for the first time.
This approach may require a bit of tweaking to get working with your setup, but hope it gives you a starting point.

Running jar in java using a specific user

Let me explain the problem:
Context
I have this application that wants to update. It call an updater jar that I have also made. The updater kill the application running the old version and the updater starts up a new one with the new version.
Problem
The new version doesn't start unless I run the jar my self. Adding a sleep didn't solve the problem.
Hypothesis
Maybe the user running the updater app is java and it doesn't have the priviliges to run the new version
I run the first java with my user than this java application run the jar with "java user" and java user can't run the new version.
Is there a way I can specify a user when I run my jar with the runtime.
Runtime.getRuntime().exec("C://Temp//myapp.jar");
In case you are using Windows environment, trying following might help your cause
try the command on the windows system32 path
runas /showtrustlevels
You should get something like the following:
C:\Windows\system32>runas /showtrustlevels
The following trust levels are available on your system:
0x20000 (Basic User)
You would then take the value for "Basic User" and run something like the following to start jar:
runas /trustlevel:0x20000 "java -jar yourfileName.jar"
or you could try this link it might be useful

Categories