10

I have a Windows file.exe and I need Wine and Java to open it. I don't know how to install Java in Wine. When I try to open Java setup it says

Wrapper.CreateFile failed with error 32: Sharing Violation. 

And it also say

Wrapper.CreateFile failed with error 123: Invalid name. Please Help.
3
  • 1
    Java in Wine isnt very stable, nor reliable. What program are you trying to run that requires Java?
    – Thomas Ward
    Mar 29, 2012 at 15:05
  • Normally Wine is a Windows emulator, and you have java already installed. It sounds very strange to me that you need the .exe and the java together and running in linux ubuntu
    – user42375
    Mar 29, 2012 at 15:15
  • I want to run Minecraft Thailand. Minecraft Thailand is a server. We need to download the EXE file to play on the server.
    – user52583
    Mar 30, 2012 at 9:30

3 Answers 3

11

I've discovered the problem and have found the solution (See Below).

The Problem

A Windows directory needs to exist:

C:\Users\USERNAME\appdata\LocalLow\Sun

On your box, you have the following directory structure, most likely:

/home/USERNAME/.wine/drive_c/users/USERNAME/

*Where USERNAME is your actual user name

The Solution:

  1. Make the subdirectories

    (Point and Click Method)

    Open Home Folder
    Open .wine
    Open drive_c
    Open users
    Create Folder appdata
    Open appdata
    Create Folder LocalLow
    Open LocalLow
    Create Folder Sun

    (Console/Terminal)

    cd /home/`whoami`/.wine/drive_c/users/`whoami`/
    mkdir -p appdata/LocalLow/Sun
    

    *NOTE: appdata/LocalLow/Sun IS case sensitive, so type it exactly as is shown

  2. Double click on the JRE executable (I used 32 bit, but I believe 64 bit works too. Be sure to check winehq's website and your version of Ubuntu to be sure)

  3. Install away :)

Importance/Relevance

As there are some programs that are Windows specific, and only partially use Java, I found that I still needed a solution to this problem. Therefore, I have provided the aforementioned procedure to solve the problem.

Reference

1
7

You do not need wine to run the Minecraft launcher on Ubuntu, just do the following

  1. Download and save the jar file from the Minecraft website.
    https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar
  2. Install "OpenJDK Java 7" from the Software center.
  3. Locate the .jar file and go to the permissions tab in the properties.
  4. Click "allow executing file as program".
  5. Go to the "Open With" tab and set "OpenJDK Java 7 Runtime" as default.
  6. Click the jar file, and you can start playing minecraft on Ubuntu  : )
1
  • 6
    While this answer technically solves the issue for the original asker, it doesn't help anyone who else who does require installing the JRE for a Windows-only application (such as, for example, Autodesk Synthesis). Aug 5, 2017 at 3:33
0

Since I recently needed to do this for a modding utility, I figured I'd add a 2023 update for this (mostly for the benefit of any wandering in from search engines). And no, I was not playing Minecraft, I agree with Cody's answer for that one.

In my case, I was playing around with the GOG version of Morrowind and I wanted to get the Mod Organizer 2 mod manager (exe) to open the Esp-QuickEditor jar file. This mod manager creates a virtual filesystem and you need to launch whatever app from within the mod manager for it to see said virtual filesystem. Hence, using my system's installed jre wouldn't do for this particular use-case. I should probably also note that I'm on Fedora (Fedora 38 + wine-8.17 Staging at time of writing) but these steps should be distro agnostic as far as I'm aware.

Also, I did NOT have to create the folder drive_c/users/$USERNAME/appdata/LocalLow/Sun as suggested by the other answer - it was created automatically by the installer. Likewise, I did NOT need to use winxp as suggested by the winehq appdb (I had run WINEPREFIX=/path/to/my/prefix winetricks win10 prior to installing the jre).


First, trying to run the installer normally, will give an error as mentioned by the original poster. That much still hasn't changed as of Oct 2023 / jre1.8.0_381 (I don't recall if it was the same error; I think it was something else for me actually but I do remember that running it normally wasn't working)

1. I downloaded the offline installed "jre-8u381-windows-x64.exe" and copied it to a temp folder under my prefix (e.g. drive_c/temp).

At the time of writing, that's the "Windows Offline (64-bit)" link on this page: https://www.java.com/en/download/manual.jsp

2. Going under the assumption that if I did a silent install, it would not need to draw a gui (and thus there would be less stuff that could fail) and that if I could turn off other features - like the analytics - there would be even less stuff that could fail, I took a look at the installer options documented here and here and used that to create a config file for the installer.

cd "$WINEPREFIX/drive_c/temp"
printf '%s\n' STATIC=1 AUTO_UPDATE=Disable INSTALL_SILENT=Enable INSTALLDIR='C:\java\jre' NOSTARTMENU=Enable REBOOT=Disable REMOVEOUTOFDATEJRES=0 WEB_ANALYTICS=Disable WEB_JAVA=Disable > install.cfg
unix2dos install.cfg

3. Then I ran the install with firejail + wine as a silent install with the config file, ignoring any errors on the terminal

/usr/bin/env WINEPREFIX="/path/to/my/prefix" /usr/bin/firejail --profile=custom12 --whitelist="/path/to/custom/prefix" /usr/bin/wine64 start /D"C:/temp" "jre-8u381-windows-x64.exe" /s /L 'C:\temp\java-install.log' 'INSTALLCFG=C:\temp\install.cfg'

If you don't use firejail*, then that'd be:

/usr/bin/env WINEPREFIX="/path/to/my/prefix" /usr/bin/wine64 start /D"C:/temp" "jre-8u381-windows-x64.exe" /s /L 'C:\temp\java-install.log' 'INSTALLCFG=C:\temp\install.cfg'

4. After this I verified that the installer had extracted the files to drive_c/java/jre/bin as I specified in the config file. I was then able to launch the jar file successfully from under firejail + wine using

/usr/bin/env WINEPREFIX="/path/to/my/prefix" /usr/bin/firejail --profile=custom12 --whitelist="/path/to/custom/prefix" /usr/bin/wine64 start /D"C:/java/jre/bin" "java.exe" -jar 'C:\temp\Esp-QuickEditor.jar'

If you don't use firejail*, then that'd be:

/usr/bin/env WINEPREFIX="/path/to/my/prefix" /usr/bin/wine64 start /D"C:/java/jre/bin" "java.exe" -jar 'C:\temp\Esp-QuickEditor.jar'

* For those unfamiliar with firejail, it is a security sandboxing program. the --profile=custom12 is me pointing it a modified version of the wine profile that comes with the package (on Fedora at least); you can replace it with --profile=wine or write your own custom profile and put it in ~/.config/firejail. My custom profile just blocks a couple extra things and virtualizes a fake home folder.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .