This question already has answers here:
How to set 'Run as administrator' on a file using Inno Setup
(3 answers)
Closed 4 years ago.
I'm currently working on a project where I have to build a desktop application using JavaFX. I'm using the javafx-gradle-plugin (https://github.com/FibreFoX/javafx-gradle-plugin) for building and bundling the application.
Everything works fine, but after the installation the application doesn't request administrator privileges to run. If I start it with admin user everything works, but if you start it as a "normal" user the application doesn't work.
Is there a way for requesting admin privileges when starting the .exe?
thank you in advance for your help
I found the solution to my problem.
I added an entry in my .iss file for generating the InnoSetup installer like this:
[Registry]
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\"; ValueType: String; ValueName: "{app}\xxx.exe"; ValueData: "RUNASADMIN"; Flags: uninsdeletekeyifempty uninsdeletevalue; MinVersion: 0,6.1
Be aware that when you add this entry you have to add runascurrentuser to your Run configuration like this:
[Run]
Filename: "{app}\xxx.exe"; Parameters: "-Xappcds:generatecache"; Check: returnFalse()
Filename: "{app}\xxx.exe"; Description: "{cm:LaunchProgram,xxx}"; Flags: runascurrentuser nowait postinstall skipifsilent; Check: returnTrue()
Filename: "{app}\xxx.exe"; Parameters: "-install -svcName ""xxx"" -svcDesc ""xxx"" -mainExe ""xxx.exe"" "; Check: returnFalse()
Related
So I was trying to make a 1.17.1 minecraft server on my mac. I couldn't open my 1.17.1_server.jar with Java 8 so I download Java 16.0.2.
Unfortunately, everytime I was opening the 1.17.1_server.jar file, I got
"The Java JAR file "1.17._server.jar" could not be launched." .
I first thought that it was because the file was launch by Java 8 instead of 16.
So I went into the terminal and run :<path to java> -jar 1.17.1_server.jar
I then got this : Error: Unable to access jarfile 1.17.1_server.jar
Finally i tried to put the path of the jar file in the command...
So I've run : path to java -jar path to server
and got this :
[main/ERROR]: Failed to load properties from file: server.properties
[15:57:35] [main/WARN]: Failed to load eula.txt
[15:57:35] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
So why I have to agreed Eula if i've never launched it ? Does it think that he already been launched ?
As stated in the error message
[15:57:35] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
You have to open the file and check yes
Okay find the solution: my eula and server properties file were in my user folder dk why (never moved them so...)
I have a basic java app using java.awt Swing UI and I want to create a snap for it so when it's installed there is a launcher available and my UI Launches. I use gradle and the jar task to create a jar which works fine.
Naturally I have in a class that when called loads my app just fine:
package com.foo
class Bar() {
static void main(String... args) { launchUI() }
}
I created a snap folder at the root of the project and a snap.yaml where i followed the instructions on https://snapcraft.io/docs/java-applications so i have a snap yaml that produces a snap file which also installs fine:
name: deepthought
base: core18
version: '0.0.7'
summary: ""
icon: gui/foo.png
description: |
Computes the ultimate answer for life the universe and everything
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
# This doesn't work
#apps:
# htmldoc:
# command: desktop-launch $SNAP/bin/foo.sh
## desktop: share/applications/htmldoc.desktop
# plugs: [home, network, x11]
parts:
foopart:
plugin: gradle
source: https://github.com/bsautner/foo.git
source-type: git
gradle-options: [] # suppress running of tests and run the war task
gradle-output-dir: build/libs
I've spent quite some time trying to figure out:
If i create a shell script to run a java -jar foo.jar command it ends up in the /snap directory but it's not on the users path so they can't get to it
I've tried creating launchers but always get an error that my launcher can't be found, if i put it in my root folder as /bin/launch.sh snap can't find it and if i put it in the snap/bin/ folder i also get errors to not put things in the snap folder
When I do install my snap, i don't see where it puts my jar i want to execute, so i can't write a script that does that
I'd really appreciate if anyone can share a working snap.yaml for a java program with a launcher and if there is any mention of a path to something that you note where those files are in relation to the path of the /snap/snap.yaml file
ok figured it out - the docs don't say this but the files are relative to the root of the project so even though the yaml says this is the launch
apps:
cmd3:
command: usr/bin/foo.sh
foo.sh should be in the root of the project and the orginize section here moves it to the bin dir
foo:
plugin: gradle
source-type: local
source: .
build-packages:
- openjdk-11-jdk
stage-packages:
- openjdk-11-jdk
- x11-utils
organize:
${SNAPCRAFT_PART_BUILD}/jg-snap: usr/bin/foo.sh
The jar is in the /snap/foo/current/usr/jar directory
This question already has answers here:
Connect Java to a MySQL database
(14 answers)
Closed 6 years ago.
I am a newbie to J2EE.I have checked similar questions but nothing helped.
I am creating a simple login application but i am facing the above error.
I have mysqlconnector in build path and a lib folder as shown in the image :SQL connector
The source code of the application is as follows:
LoginDao.java
This file connects the application to mysql database.
String userName = "root";
String password = "mysql";
I have provided the username and password of mysql here.Is this correct?
For this I have created a database in mysql:
create database form;
use form;
create table login(username varchar(20),pass varchar(20));
show tables;
insert into login values("nehal",12345);
Now the project runs properly but when i enter username as nehal and password:12345, it gives the above error:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
1 way =>Paste the mysqlconnector.jar file in jre/lib/ext folder.
2 way => set classpath
open comman prompt and write:- C:>set classpath=c:\folder\mysql-connector-java-5.0.8-bin.jar;.;
in IDE :
Right Click the
project -- > build path -- > configure build path
In Libraries Tab press Add External Jar and Select your jar.
Don't know eclipse that much but i would guess that your library is mussing at runtime. As i see you use apache tomcat and it seems that it doesn't has that mysql jar.
You have to add that jar to your apache tomcat. See Where do I have to place the JDBC driver for Tomcat's connection pool?
I am using Ant and Inno Setup to build a self deploying EXE for a JavaFX application.
For change the install folder I follow the answer of this topic
JavaFX Self Installer With Inno Setup 5 - Allow user to change install directory
But after make change I have now a problem i don't know where put exactly the new .iss file
I use eclipse, this is my project tree :
Quizz
|.settings
|bin
|build
|build
|deploy
|bundles
/* Exe here when I not change the iss file */
|dist
|project
|build.xml
|src
This is a part of my iss file, when i run him he don't find the icon and the exe file.
[Files]
Source: "Quizz\Quizz.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Quizz\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\Quizz"; Filename: "{app}\Quizz.exe"; IconFilename: "{app}\Quizz.ico"; Check: returnTrue()
Name: "{commondesktop}\Quizz"; Filename: "{app}\Quizz.exe"; IconFilename: "{app}\Quizz.ico"; Check: returnFalse()
[Run]
Filename: "{app}\Quizz.exe"; Parameters: "-Xappcds:generatecache"; Check: returnFalse()
Filename: "{app}\Quizz.exe"; Description: "{cm:LaunchProgram,Quizz}"; Flags: nowait postinstall skipifsilent; Check: returnTrue()
Filename: "{app}\Quizz.exe"; Parameters: "-install -svcName ""Quizz"" -svcDesc ""Quizz"" -mainExe ""Quizz.exe"" "; Check: returnFalse()
[UninstallRun]
Filename: "{app}\Quizz.exe "; Parameters: "-uninstall -svcName Quizz -stopOnUninstall"; Check: returnFalse()
So the question is where I should put the iss file ?
If someone can help me he will be very very nice.
I didn't find the answer but I found a workaround :
There are two .exe files, the application .exe that runs the jar, and the self-deploying .exe generated by Inno-Setup.
I used the Ant script to generate the application .exe, by changing nativeBundles to "all" like so:
<fx:deploy
...
...
nativeBundles ="all"/>
Once run, the Ant script creates a .jar, .jnlp, the jre and the two .exe.
The application .exe, which is needed by Inno Setup, is actually generated then destroyed silently when you choose nativeBundles="exe".
So with nativeBundle="all" I was able to customize my Inno Setup script, so it installs the exe and the jre in the right folder.
The answer is: your modified .iss file should be placed in SAME_DIR_AS_YOUR_ANT_BUILD_FILE\package\windows\ (create those folders if they don't exist). More info can be found in this Oracle article, section 6.3.3.
I have Netbeans set up on my project so that "Right click project -> Package As -> EXE Installer" will create an executable installer for the application.
The issue is that the installer sets up the application locally in
C:\%USERNAME%\AppData\Local\ApplicationName.
Is there any way to have the installer allow for selecting installation directory or, at the very least, install the application for all users?
usually we use C:\program files\...
I ended up no using the tools that Netbeans has built in since I find them very limiting.
Netbeans uses Inno Setup to create its executable files. Though it may exists, I could not find where to edit the script that Inno uses to create those executable files, so I went about it on my own.
I used this guide to combine all the dependencies into my application. If you have more than one, you add extra lines where the file says to do so.
I used Launch4j to package my .jar as a .exe.
I used Inno Setup to take that executable and make an installer with an icon, desktop icon and start menu icon support, and uninstall support. This is the script that I used (mostly generated with the gui) with removed personal info:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId=generated guid
AppName=app name
AppVersion=1.0
;AppVerName=app version name
AppPublisher=company name
AppPublisherURL=company name
AppSupportURL=company site
AppUpdatesURL=company site
DefaultDirName={pf}\app name
DefaultGroupName=app name
AllowNoIcons=yes
OutputDir=output directory
OutputBaseFilename=setup
SetupIconFile=icon directory
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "exe location"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\application name"; Filename: "{app}\exe file"
Name: "{group}\{cm:UninstallProgram,application name}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\application name"; Filename: "{app}\application name.exe"; Tasks: desktopicon
[Run]
Filename: "{app}\application name.exe"; Description: "{cm:LaunchProgram,application name}"; Flags: nowait postinstall skipifsilent
I know this didn't really get a lot of traffic, but I hope it helps anyone that comes across it later.