Skip to content
This repository has been archived by the owner on Oct 23, 2018. It is now read-only.

"Current file is not main class" error when running main class #71

Open
ROODAY opened this issue Sep 17, 2016 · 14 comments
Open

"Current file is not main class" error when running main class #71

ROODAY opened this issue Sep 17, 2016 · 14 comments

Comments

@ROODAY
Copy link

ROODAY commented Sep 17, 2016

When running the command "Builds->Run Main Class" from the Javatar menu, I get a popup with the error "Current file is not main class." However, building works fine. Looking in the ST3 console shows nothing, and I have no idea why I'm not able to run the files on this computer, as my laptop with the same versions for ST3, Java, and Javatar is able to run the files with no issue.

@spywhere
Copy link
Owner

spywhere commented Sep 18, 2016

Javatar does not use Sublime Text's build system at all. If you want to compile the project, please use Javatar's build system instead. And also could you give me the following info?

  • Sublime Text version
  • Javatar version
  • A log from Sublime Text's console (after run the command)
  • Action History (via Ctrl/Cmd+Shift+K, Ctrl/Cmd+Shift+H) after run the command
  • A screenshot of the file you used for run the command
  • In case of screenshot is not possible,
    • The most outer project structure (for example: src and out folder)
    • A package path in the status bar (if any)
    • Check if there any main method in the current file

@ROODAY
Copy link
Author

ROODAY commented Sep 18, 2016

  • ST3 Version: Stable, Build 3114
  • Javatar Version: 1.0.2
  • Console log: Nothing appears in console
  • Command History: Nothing appears
  • Screenshot

@ROODAY
Copy link
Author

ROODAY commented Sep 20, 2016

Are there any other plugins that are known to not work well with Javatar that could be causing this issue? Because I do have more plugins on my desktop than I do on my laptop.

@spywhere
Copy link
Owner

As far as I know, no. There is no plugin conflict since I release the Javatar.

@spywhere spywhere added the bug label Sep 21, 2016
@ROODAY
Copy link
Author

ROODAY commented Sep 21, 2016

Hmm, if it'll help, here is the package list on my desktop

"installed_packages":
    [
        "3024 Color Scheme",
        "Alignment",
        "Babel",
        "BracketHighlighter",
        "Can I Use",
        "Clipboard Manager",
        "ColorPicker",
        "CSScomb",
        "Diffy",
        "DocBlockr",
        "Emmet",
        "Emmet Css Snippets",
        "Emmet Style Reflector",
        "Hayaku - tools for writing CSS faster",
        "HTML5",
        "Javatar",
        "LaTeXTools",
        "MarkdownEditing",
        "Material Theme",
        "Package Control",
        "PackageResourceViewer",
        "Processing",
        "Sass",
        "SideBarEnhancements",
        "SideBarFolders",
        "SublimeREPL",
        "Syntax Highlighting for Sass",
        "Terminal"
    ]

@spywhere
Copy link
Owner

If possible, could you please try replicate the issue again with only Sublime Text and Javatar (Package Control is optional, you could install it in order to install Javatar and leave it there).

If the issue still persist, could you try with Javatar v2.x.x? Which could help me know if it's the main class algorithm issue or the structure of the project itself.

@ROODAY
Copy link
Author

ROODAY commented Sep 21, 2016

I just tried running a Java program using the latest ST3 portable build, Package Control, and the latest stable Javatar (not 2.x.x) and it worked, so I think its some conflict with a package. I'm going to remove some old packages and see what happens.

UPDATE

I removed all the packages I had on my desktop that I didn't have on my laptop, and the same error still persists. Perhaps something has been corrupted with my sublime installation?

@ROODAY
Copy link
Author

ROODAY commented Sep 24, 2016

Huh, so sublime just updated to Build 3126 and I'm no longer getting the "File is not compiled" error. No idea why it wasn't working in the first place, but it's gone now.

..... and nevermind, closing and reopening ST3 reintroduced the problem.

I tried deleting the ST3 folder from AppData and uninstalling ST3. then reinstalling ST3 and installing only Package Control and Javatar. Still didn't work. Will try the 2.x.x version of Javatar now.

@ROODAY ROODAY closed this as completed Sep 24, 2016
@ROODAY ROODAY reopened this Sep 24, 2016
@ROODAY
Copy link
Author

ROODAY commented Sep 24, 2016

Trying to build a file with SublimeLinter and Javatar 2.x.x installed as the only packages gives me this error:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 795, in run_
    return self.run(**args)
  File "commands.builds.build in C:\Users\Rudhra\AppData\Roaming\Sublime Text 3\Installed Packages\Javatar.sublime-package", line 129, in run
  File "commands.builds.build in C:\Users\Rudhra\AppData\Roaming\Sublime Text 3\Installed Packages\Javatar.sublime-package", line 111, in build_class
  File "core.build_system in C:\Users\Rudhra\AppData\Roaming\Sublime Text 3\Installed Packages\Javatar.sublime-package", line 224, in build_files
  File "core.jdk_manager in C:\Users\Rudhra\AppData\Roaming\Sublime Text 3\Installed Packages\Javatar.sublime-package", line 115, in get_executable
KeyError: 'bin'

@spywhere
Copy link
Owner

Hmm, could you check your Sublime Text's settings? Did Javatar add a correct JDK path and such into your settings? Meanwhile, I will check Sublime Text for potential API changes as you seem to get error on specific build of it.

@ROODAY
Copy link
Author

ROODAY commented Sep 25, 2016

I used the Javatar Menu and reselected "Default JDK" and tried running classes, and it seems to be working for now, but again I have no idea what has changed to facilitate this. (I also installed the other packages I normally use and there seems to be no issues) However, and I think this to be a separate issue with 2.x.x, I found that closing and re-opening ST3 will reset the selected source folder and go back to using the root folder by default. I have to manually add the proper source folder and then the files build and run properly.

@spywhere
Copy link
Owner

Ah... that would make sense. Sublime Text does not store any project data upon quit / exit the program so any data that Javatar stored will be lost (this including source folder, selected JDK and project-wide settings). You have to use a project in the Sublime Text in order to store these data upon reopening the Sublime Text. Both Sublime Text 2 and 3 has this effect hence both Javatar v1.x.x and v2.x.x could affect by this.

@ROODAY
Copy link
Author

ROODAY commented Sep 29, 2016

I just updated ST3 on my Linux laptop and ran into the same "File is not compiled error," which was fixed by upgrading to Javatar 2.x.x. At this point I believe that there is an issue with the current stable branch of Javatar and the current build for ST3. What that issue is I have no clue however, as the error in the console just says that the file is not compiled.

@spywhere
Copy link
Owner

Alright, thanks for the work you've done. I'll try to reproduce it on my machine and see if it's also happens to me. If not, I think I'll leave this issue open as it still unclear of what cause this to happen.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants