简体   繁体   English

Netbeans插件在调试时可以完美地工作,但是在将插件安装到IDE时不能工作

[英]Netbeans plugin works perfectly while debugging, but not working when the plugin is installed to the IDE

I am currently working on a Java plugin for Netbeans 6.9.1 using the Apache POI api for interfacing with Microsoft documents that has two functions, the first takes data from a properties text file and creates an excel spreadsheet(.xlsx) containing that data, and the second part takes text from a spreadsheet and adds it to a properties text file. 我目前正在使用Apache POI api开发NetBeans 6.9.1的Java插件,以与具有两个功能的Microsoft文档进行交互,第一个功能是从属性文本文件中获取数据,并创建一个包含该数据的excel电子表格(.xlsx),第二部分从电子表格中获取文本,并将其添加到属性文本文件中。

When I run the code in the debugger both of the functions work great. 当我在调试器中运行代码时,两个功能都很好用。 The files get created and edited as they are supposed to, but I ran into problems when I created the NBM from the project and installed the plugin. 这些文件将按照预期的方式创建和编辑,但是当我从项目创建NBM并安装插件时遇到了问题。 The import (from .xlsx to .txt) does not do change the contents of the text file. 导入(从.xlsx到.txt)不会更改文本文件的内容。 I have checked variables at various times in the code to make sure there's nothing wrong with them there and everything was as it should. 我在代码中的各个时间检查了变量,以确保那里没有错误,并且一切都正常。 The export (.txt to .xlsx) works fine in the plugin, so I'm not sure exactly what's going on. 导出(从.txt到.xlsx)在插件中工作正常,因此我不确定到底发生了什么。 When I start the import it goes through the steps, but nothing ever gets changed or written to the final files. 当我开始导入时,它会完成所有步骤,但是没有任何更改或写入最终文件。

I'm pretty new to Netbeans so I'm not sure if there is a major difference from debugger to the actual plugin that is affecting how the program acts. 我是Netbeans的新手,所以不确定从调试器到实际插件是否有重大差异,这会影响程序的运行方式。 Any help 任何帮助

The problem was creating a temporary file to write to. 问题是创建一个要写入的临时文件。 In the debugger it wrote to the projects folder, whereas when it was installed as a plugin it was creating the temporary file in Program Files. 在调试器中,它写入了项目文件夹,而当它作为插件安装时,则在程序文件中创建了临时文件。 Windows wasn't letting the program get at the file once it was created in that directory so I changed it to create the file in Local App Data instead. Windows不允许程序在该目录中创建文件后立即获取文件,因此我将其更改为在“本地应用程序数据”中创建文件。

$    System.getProperty("user.home") + "\\Local Settings\\Application Data"

Glad that it's finally working, wasted a lot of time on such a simple fix, hope this can help someone else in the future. 很高兴它终于可以正常工作,在这样一个简单的修复方法上浪费了很多时间,希望这可以在将来对其他人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Eclipse插件在调试时有效,但在安装时无效 - Eclipse plugin works when debugging but not when installing 插件可在Eclipse IDE中进行更好的调试 - Plugin for better debugging in Eclipse IDE Netbeans 8.0修改已安装的插件 - Netbeans 8.0 Modify installed plugin netbeans中的Java程序无法正常运行,但在调试时可以正常运行 - Java program in netbeans won't run properly but works perfectly fine when debugging 由 maven 插件打包的 Spring 引导应用程序不起作用,在 IDE 中工作 - Spring boot application packaged by maven plugin not working, works in IDE 安装插件后无法执行动态执行 - Dynamic execution is not working when the plugin was installed 如何在Netbeans IDE中安装Android插件? - How to install Android plugin into the Netbeans IDE? JavaFX GUI 在 Netbeans IDE 上工作得很好,但在 eclipse 上不行 - A JavaFX GUI is working perfectly fine with Netbeans IDE, but not with eclipse System.getenv()仅在调试IntelliJ插件时正常工作 - System.getenv() only works properly when debugging IntelliJ plugin onFaceDetection在运行时只调用一次或两次,但在使用断点进行调试时效果很好 - onFaceDetection called only once or twice while running but works perfectly when debugging with breakpoints
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM