New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
gzvincen opened this issue
Feb 8, 2018
· 9 comments
Closed
INTERNAL ERROR
#197
gzvincen opened this issue
Feb 8, 2018
· 9 comments
Comments
Same problem here with the new jd-gui 1.43
While jd-gui 1.41 with the jd-core 1.0.0 preview actually worked and improved resulting code considerably over luyten and other decompilers results.
Problem is that jd-gui 1.4.1 does not allow copying the 1.0.0 output, only 0.7.1 comparison results can be copied.
Is there a way to call the jd-core 1.0.0 library in the jd-gui 1.4.1 directly ?
I tried something like the following without success.
$JAVA_HOME/java -jar jd-gui-1.4.1-jd-core-1.0.0-preview-20190315/ext/jd-core-1.0.0-preview.jar com/lowagie/text/pdf/PdfReader.java
Actually I suppose this can be attributed to #93 and maybe #90, as the class in Question makes uses of inner classes.
Hi, JD-GUI 1.4.3 replace the old JD-Core 0.7.1 with the (rewrite from scratch) new JD-Core 1.0.0. Try it : it should solve this issue.
Hi @java-decompiler,
thanks for your fast response, much appreciated!
I have had positive results with your preview jd-gui-1.4.1 in many cases. But the now available jd-gui 1.4.3 is showing the INTERNAL-ERROR as reported by gzvincen and other bug reporters. I guess it may have something to do with internal classes, as the classes failing with INTERNAL ERROR also have internal classes in my case.
- JD-GUI 1.4.1 works both with jd-core 1.0.0-preview (right) and jd-core-0.7.1 (left in the side-by-side view).
- JD-GUI 1.4.3 does show INTERNAL ERROR with jd-core-1.0.0 final version for a lot but not all classes.
I just tried JD-GUI 1.5.0 with no success either for the PdfReader.class from a 2.0.2 iText library I am trying to decompile.
- JD-GUI 1.5.0 does show INTERNAL ERROR with jd-core 1.0.1
@gzvincen : JD-Core 1.0.+ have a problem with Lambda expression in PowerfulDockerImpl => I’ll take a look.
@stefan123t : NPE throws by JD-GUI caused by a bug in JD-Core-1.0.+ on a anonymous inner class => I’ll take a look.
@emmanue1: Thanks for this really quick and working fix.
This is an unrivalled resolution time!
I have built the latest jd-core trunk with the Commit java-decompiler/jd-core@ca0e165 and it fixed the problem with my PdfReader.class
Many thanks for your outstanding support!
amy-yu-001
pushed a commit
to amy-yu-001/jd-gui
that referenced
this issue
Mar 17, 2020
Recently I came across a problem where we need to do some changes in a small application where we don’t have the source code.
Around 5 years back my team members built a small application for a temporary purpose and we used it for a while and forgot about it. Recently we got a similar kind of requirement again temporarily. We got the jar file which we deployed at that time. We have a small change in requirement but we realized we lost this application code at the time of SVN to Git migration. For a temporary requirement, we don’t see a point of building whole application again so we thought why not decompile the code and change it a bit and deploy it again.
In this process, I faced a couple of roadblocks I thought it’s worth sharing. To share the journey with you all let me create an example project and play with it. I built a small application which converts weights & distances from one measurement to another. You will find it’s source and jar file here. You can find the jar too.
To run this application you need to run one of the following commands
java -cp jar/java-decompile-example-1.0.0.jar com.arvind.converter.Converter OR mvn exec:java -Dexec.mainClass="com.arvind.converter.Converter"
You will get output like this
Which converter you want to play with (distance, weight)? distance Convert from (in, ft, mi, mm, cm, m, km): m Convert to (in, ft, mi, mm, cm, m, km): km Value: 1012 1012.0 m = 1.0 km
Now let’s assume we don’t have the source code and we want to do a couple of changes.
1) We are unnecessarily doing rounding so we want to remove it.
2) Inch to meter conversion value from 0.0254001 to 0.0254.
3) Printing message mistake. “to” need to be written in the place of ”from” for one of the weight conversion message dialogues.
Let’s start the interesting part now.
First, to decompile the code we need Java Decompiler. Right now I am using ubuntu 18.04 so with the simple command I am able to install my favorite decompiler JD-GUI.
sudo apt-get install jd-gui
or else you can follow the steps given in JD-GUI GitHub repository.
git clone https://github.com/java-decompiler/jd-gui.git
cd jd-gui
./gradlew build
We need to open our jar file through JD-GUI.
Let’s pick the first task and do it. We need to remove Round functionality. Basically, we are rounding in UnitConverter level so let’s take those decompiled files and do the changes.
We need java files to change so we can save those decompiled class files as java files. Open the class file which you want to save.
Then save it.
Now let’s do our first task.
Task 1:
Now I will remove the Math.round so that unncessary rounding will be gone.
Now our java files are ready so let’s compile them and create new class files. At the time of compilation, we need to thought about a couple of things.
- Classpath (Dependency jars and etc.)
If we don’t put it correctly we will get a lot of compilation issues. - Java version on which we are targetting. If we don’t put it correctly then our other class files are in different java version and the current class file on which java file we are working will be in the different version then we get Unsupported major.minor version error. Don’t forget we built this jar using Java 1.6 version.
Compilation command will be like this
javac -source 1.6 -target 1.6 -classpath ../RealTimeData.jar ../RealTimeDataAccess.java
When you run this command most probably you will get below warning & errors.
warning: [options] bootstrap class path not set in conjunction with -source 1.6 UnitConverter.java:28: error: variable meters is already defined in method toMeters(double) double meters; ^ UnitConverter.java:35: error: variable meters is already defined in method toMeters(double) double meters; ^ UnitConverter.java:42: error: variable meters is already defined in method toMeters(double) double meters; ^ UnitConverter.java:49: error: variable meters is already defined in method toMeters(double) double meters; ^ UnitConverter.java:56: error: variable meters is already defined in method toMeters(double) double meters; ^ UnitConverter.java:63: error: variable meters is already defined in method toMeters(double) double meters; ^ UnitConverter.java:80: error: variable converted is already defined in method fromMeters(double) double converted; ^ UnitConverter.java:87: error: variable converted is already defined in method fromMeters(double) double converted; ^ UnitConverter.java:94: error: variable converted is already defined in method fromMeters(double) double converted; ^ UnitConverter.java:101: error: variable converted is already defined in method fromMeters(double) double converted; ^ UnitConverter.java:108: error: variable converted is already defined in method fromMeters(double) double converted; ^ UnitConverter.java:115: error: variable converted is already defined in method fromMeters(double) double converted; ^ 12 errors 1 warning
Don’t panic these kinds of errors are quite common. If you see closely the decompiled java file has many times declaration for converted and meters.
private double fromMeters(double meters) { double converted; double converted; if (this.toUnit.equals("in"))
Remove unnecessary declaration of converted and meters and remove unnecessary System.out.println statements in convert function if there are any. Do the same in the other UnitConverter.java too.
Now compile these java files again. You will find the class files. Now we need to put our class files in the jar files. This is simple we can replace them in jar file only by using Archive Manager.
Open the jar file using Archive Manager and go the folder where you want to replace your class file and click on add files
Now select the class file.
Now your class file will be replaced.
You can see the modified file.
Now run the jar file using the following command
java -cp java-decompile-example-1.0.0.jar com.arvind.converter.Converter
You will get output like this
Which converter you want to play with (distance, weight)? distance Convert from (in, ft, mi, mm, cm, m, km): m Convert to (in, ft, mi, mm, cm, m, km): km Value: 1012 1012.0 m = 1.012 km
Congrats!!! Your first task is done. Not bad right.
Now let’s do the task 2.
Task 2:
Inch to meter conversion value from 0.0254001 to 0.0254.
We need to do the changes in UnitConverter you might be wondering we kept our constants in Constants java file but Ashok is saying do the changes in UnitConverter. This is due to one of the beauties of Compilation time optimizations. We are declaring Constants in a single place and using in multiple places so that if we do changes at one place but the compiler doesn’t see any point of getting the value from a different place every time so it just put the value there.
Now change the 0.0254001 to 0.0254 at the following line.
private double toMeters(double val) { double meters; if (this.fromUnit.equals("in")) { meters = val * 0.0254001D; }
Same steps again compile it and replace it in the jar file. Your second task also completed. Congrats again.
Now let’s do the task 3.
Task3:
Printing message mistake. “to” need to be written in the place of ”from” for one of the weight conversion message dialogues.
At the time of weight conversion, you can see below that input question have from instead of to
Which converter you want to play with (distance, weight)? weight Convert from (lb, kg, g, mg, oz, t): g Convert from (lb, kg, g, mg, oz, t): oz Value: 102 102.0 g = 3.597948 oz
Let’s get decompiled version java file for Converter and do the changes and compile it. Now you might get the following error.
warning: [options] bootstrap class path not set in conjunction with -source 1.6 Converter.java:7: error: a type with the same simple name is already defined by the single-type-import of UnitConverter import com.arvind.converter.weight.UnitConverter; ^ 1 error 1 warning
This error coming because we have 2 UnitConverter java files in different packages and using both of them in a single place. Here we need to use them with the full package instead of importing or else one we can import and another we can use with the full package. So in these cases decompiler get confused and writes both import statements.
Here we can remove both import statements and we can use like this
if (isItDistanceConverter) { converter = new com.arvind.converter.distance.UnitConverter(fromUnit, toUnit); } else { converter = new com.arvind.converter.weight.UnitConverter(fromUnit, toUnit); }
Now let’s compile it and replace in the jar. Run the code again. Now you will get proper output
Which converter you want to play with (distance, weight)? weight Convert from (lb, kg, g, mg, oz, t): g Convert to (lb, kg, g, mg, oz, t): oz Value: 1346 1346.0 g = 47.478804 oz
Congrats once again for completing the 3rd task!!!
I am aware that when decompiling a jar file, it is normal for the resulting .java files to contain syntax errors, but I am unsure of why and worse off I am sometimes unsure of how to fix these syntax errors. Take int[] arrayOfInt = new int['€'];
, for example. Eclipse complains that '€'
does not belong. Surprise! I know this already, but why does this happen. How can I find out what this value should be?
asked Nov 5, 2014 at 0:43
1
The reason it happens is because JD-Gui isn’t encoding unicode properly. You can see that the thing inside the quotes is two bytes, and appears to be interpreted as nonstandard upper 128 characters. I.e. JD-Gui is emitting unicode, but the charset isn’t declared correctly so your editor interprets it as two raw bytes in an 8bit charset instead of a single unicode character.
One solution is to use a Decompiler that emits unicode escapes instead of raw unicode byte sequences. That way, any editor will be able to view it correctly. I’d recommend Procyon (it’s a lot better than JD-Gui anyway).
answered Nov 5, 2014 at 3:29
AntimonyAntimony
1,97210 silver badges14 bronze badges
5
You should use Luyten. It is a java decompiler just like JD-Gui, but it lacks much of the bugs inside jd-gui logic.
It is a front-end to Procyon.
PS: Sorry, I know i should commenting on Antimony’s answer, but i don’t have the necessary points to do that.
answered Nov 5, 2014 at 16:49
1
Try taking a look at Bytecode Viewer — https://github.com/Konloch/bytecode-viewer
It allows you to select from 3 different Java decompilers. It can also display the Bytecode and Hexcode of the Class file you select. (And more, check it out)
answered Nov 18, 2014 at 5:32
KonlochKonloch
211 silver badge2 bronze badges
Я декомпилировал файл apk с помощью dex2jar и открыл получившийся файл jar в jd-gui. Я могу просмотреть почти весь код, но в одном разделе — константах — отображается только //INTERNAL ERROR//
и ничего больше. Есть ли способ получить константы?
14 июль 2013, в 23:30
Поделиться
Источник
2 ответа
Я исправил проблему, установив Java Jdk 64Bit «Java SE Development Kit 8u111»
Jamil
30 нояб. 2016, в 16:31
Поделиться
Ещё вопросы
- 0Можно ли обнаружить отмену отправки формы HTML
- 0JQuery AJAX, возвращающий отправку страницы HTML
- 0рисовать два объекта, используя openGL одновременно
- 0Соедините три таблицы с группой, указав ошибку
- 0JQuery рекурсивно проверено
- 0Запросы к нескольким таблицам в CakePHP 3.x ORM
- 0JQuery Multi Select передачи с параметрами данных
- 0Я теряю функциональность кнопки при смене фона
- 0Мой sql фильтр по последней дате
- 0Как уменьшить высоту области содержимого для <p> с помощью CSS?
- 1Как реализовать синглтон со стратегиями?
- 0Использовать массивы на нескольких страницах php?
- 0AngularJs Ресурсосбережение / кеширование
- 1Выберите столбец из текстового файла с разделителями табуляции в Python и добавьте его в файл TSV
- 0Как предотвратить создание нового rand () после cin в c?
- 0записать данные в нужную строку в уже существующий файл
- 1Объединение двух списков диктов в Python, когда некоторые диктанты являются дубликатами
- 0Составление списка элементов без абсолютного позиционирования
- 0mysql Сгруппируйте по X и покажите Total1 (когда Field = 0 той же таблицы) и Total2 (когда Field = 1)
- 0Могут ли функции слотов внутри одного объекта QThread выполняться одновременно?
- 1Получите информацию о файле почтового индекса — не от его содержания
- 1Печать непустой части круглого блеска
- 0Используйте мою переменную php в качестве формулы для вычисления чего-либо
- 0Задать значение скрытого поля ПОСЛЕ завершения загрузки файла с помощью blueimp Загрузка файла
- 1Порядок Linq по десятичному полю сортируется как строка?
- 0Как я могу установить значение ng-disabled кнопки на основе исходного значения модели
- 0Mysql оставил объединить стиль sum ()
- 0Проверка jQuery с отключенной кнопкой отправки
- 0Заменить изображение после определенного количества загрузок страницы?
- 1Отображение XML на модели, когда имя узла списка и имя узла элемента совпадают
- 0Создание эффекта калейдоскопа из изображения с использованием opencv
- 1Файлы Android Local Storage стираются при перезагрузке
- 1можно добавить ChartRangeFilter в пузырьковую диаграмму?
- 0Передача указателя не шаблонной функции в метод шаблона
- 1Фильтр уведомлений об изменениях в Active Directory: создание, удаление, восстановление
- 1вернуть None и ничего не выводить из строя
- 0SQLSTATE [HY000]: общая ошибка после выполнения запроса
- 0Третья кнопка asp.net не открывает диалоговое окно jQuery
- 0Необработанное исключение в (адрес памяти) (msvcr110.dll)
- 1d3.js поддерживает изображения на узел [дубликаты]
- 1Как добавить API в код Visual Studio
- 0Как сделать флажок изменить значение?
- 1Как проверить, если Request.QueryString не пустой
- 1Невозможно добавить атрибуты в сообщение проверки
- 0php mysql — вставить один запрос из цикла while
- 1Создание кнопки разделения для пользовательского адаптера ListView
- 1Как использовать объектный отдых с дженериками в потоке?
- 1Peewee атомных обновлений сложной логики
- 0неожиданное взаимодействие с $ _SESSION и буферизацией объекта
- 1Загрузка сборки из встроенных ресурсов во время выполнения внутри Библиотечного проекта